diff --git a/docs/api/v3.rst b/docs/api/v3.rst index 6c42647ab96..aaeb0bacc63 100644 --- a/docs/api/v3.rst +++ b/docs/api/v3.rst @@ -1826,6 +1826,46 @@ Remote Repository listing :requestheader Authorization: token to authenticate. +Embed +----- + +.. http:get:: /api/v3/embed/ + + Retrieve HTML-formatted content from documentation page or section. + Read :doc:`guides/embedding-content` to know more about how to use this endpoint. + + **Example request**: + + .. prompt:: bash $ + + curl https://readthedocs.org/api/v3/embed/?url=https://docs.readthedocs.io/en/latest/features.html%23read-the-docs-features + + **Example response**: + + .. sourcecode:: js + + { + "url": "https://docs.readthedocs.io/en/latest/features.html#read-the-docs-features", + "fragment": "read-the-docs-features", + "content": "
\n

Read the Docs ...", + "external": false + } + + :>json string url: URL of the document. + :>json string fragment: fragmet part of the URL used to query the page. + :>json string content: HTML content of the section. + :>json string external: whether or not the page is hosted on Read the Docs or externally. + + :query string url: full URL of the document (with optional fragment) to fetch content from. + :query string doctool: *optional* documentation tool key name used to generate the target documentation (currently, only ``sphinx`` is accepted) + :query string doctoolversion: *optional* documentation tool version used to generate the target documentation (e.g. ``4.2.0``). + + .. note:: + + Passing ``?doctool=`` and ``?doctoolversion=`` may improve the response, + since the endpoint will know more about the exact structure of the HTML and can make better decisions. + + Additional APIs --------------- diff --git a/docs/guides/embedding-content.rst b/docs/guides/embedding-content.rst index 3ce97910fb9..e2f090bb6af 100644 --- a/docs/guides/embedding-content.rst +++ b/docs/guides/embedding-content.rst @@ -1,7 +1,8 @@ Embedding Content From Your Documentation ========================================= -Read the Docs allows you to embed content from any of the projects we host. +Read the Docs allows you to embed content from any of the projects we host and specific allowed external domains +(currently, :djangosetting:`RTD_EMBED_API_EXTERNAL_DOMAINS`) This allows reuse of content across sites, making sure the content is always up to date. There are a number of uses cases for embedding content, @@ -57,12 +58,11 @@ from our own docs and will populate the content of it into the ``#help-container