Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not include HTTP examples using data_files anymore. #573

Merged
merged 6 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
3.2.2 (unreleased)
------------------

- Nothing changed yet.
- Do not include HTTP examples using data_files anymore, but move them below
src/plone/restapi instead and use package_data to include them.
[lgraf]


3.2.1 (2018-06-28)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Listing available actions
To list the available actions, send a GET request to the '@actions' endpoint on a specific content object:

.. http:example:: curl httpie python-requests
:request: _json/actions_get.req
:request: ../../src/plone/restapi/tests/http-examples/actions_get.req

The server will respond with a `200 OK` status code.
The JSON response contains the available actions categories (object, object_buttons, user) on the top level.
Each category contains a list of the available actions in that category:

.. literalinclude:: _json/actions_get.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/actions_get.resp
:language: http

If you want to limit the categories that are retured, pass one or more parameters
Expand Down
14 changes: 7 additions & 7 deletions docs/source/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ A JWT token can be acquired by posting a user's credentials to the ``@login``
endpoint.

.. http:example:: curl httpie python-requests
:request: _json/jwt_login.req
:request: ../../src/plone/restapi/tests/http-examples/jwt_login.req

The server responds with a JSON object containing the token.

.. literalinclude:: _json/jwt_login.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/jwt_login.resp
:language: http

Authenticating with a token
Expand All @@ -61,7 +61,7 @@ The token can now be used in subsequent requests by including it in the
``Authorization`` header with the ``Bearer`` scheme:

.. http:example:: curl httpie python-requests
:request: _json/jwt_logged_in.req
:request: ../../src/plone/restapi/tests/http-examples/jwt_logged_in.req


Renewing a token (@login-renew)
Expand All @@ -71,11 +71,11 @@ By default the token will expire after 12 hours and thus must be renewed before
expiration. To renew the token simply post to the ``@login-renew`` endpoint.

.. http:example:: curl httpie python-requests
:request: _json/jwt_login_renew.req
:request: ../../src/plone/restapi/tests/http-examples/jwt_login_renew.req

The server returns a JSON object with a new token:

.. literalinclude:: _json/jwt_login_renew.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/jwt_login_renew.resp
:language: http

Invalidating a token (@logout)
Expand All @@ -90,11 +90,11 @@ keyring in the PAS plugin (option ``use_keyring``).
The logout request must contain the existing token in the ``Authorization`` header.

.. http:example:: curl httpie python-requests
:request: _json/jwt_logout.req
:request: ../../src/plone/restapi/tests/http-examples/jwt_logout.req

If invalidation succeeds, the server responds with an empty 204 reponse:

.. literalinclude:: _json/jwt_logout.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/jwt_logout.resp
:language: http

Permissions
Expand Down
4 changes: 2 additions & 2 deletions docs/source/batching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Parameter Description
Full example of a batched request and response:

.. http:example:: curl httpie python-requests
:request: _json/batching.req
:request: ../../src/plone/restapi/tests/http-examples/batching.req

.. literalinclude:: _json/batching.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/batching.resp
:language: http

4 changes: 2 additions & 2 deletions docs/source/breadcrumbs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Breadcrumbs
Getting the breadcrumbs for the current page:

.. http:example:: curl httpie python-requests
:request: _json/breadcrumbs.req
:request: ../../src/plone/restapi/tests/http-examples/breadcrumbs.req

Example response:

.. literalinclude:: _json/breadcrumbs.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/breadcrumbs.resp
:language: http
20 changes: 10 additions & 10 deletions docs/source/comments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Listing Comments
You can list the existing comment on a content object by sending a GET request to the URL of the content object and appending '/@comments':

.. http:example:: curl httpie python-requests
:request: _json/comments_get.req
:request: ../../src/plone/restapi/tests/http-examples/comments_get.req

The server will respond with a `Status 200` and a batched list of all comments:

.. literalinclude:: _json/comments_get.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/comments_get.resp
:language: http

These following fields are returned:
Expand Down Expand Up @@ -47,11 +47,11 @@ Adding a Comment
To add a new comment to a content object, send a POST request to the URL of the content object and append '/@comments' to the URL. The body of the request needs to contain a JSON structure with a 'text' attribute that contains the comment text:

.. http:example:: curl httpie python-requests
:request: _json/comments_add_root.req
:request: ../../src/plone/restapi/tests/http-examples/comments_add_root.req

If the creation of the comment has been successful, the server will respond with a :term:`204 No Content` status and the URL of the newly created comment in the location header:

.. literalinclude:: _json/comments_add_root.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/comments_add_root.resp
:language: http


Expand All @@ -61,11 +61,11 @@ Replying to a Comment
To add a direct reply to an existing comment, send a POST request to the URL of the comment you want to reply to. The body of the request needs to contain a JSON structure with a 'text' attribute that contains the comment text:

.. http:example:: curl httpie python-requests
:request: _json/comments_add_sub.req
:request: ../../src/plone/restapi/tests/http-examples/comments_add_sub.req

If the creation of the comment has been successful, the server will respond with a :term:`204 No Content` status and the URL of the newly created comment in the location header:

.. literalinclude:: _json/comments_add_sub.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/comments_add_sub.resp
:language: http


Expand All @@ -77,11 +77,11 @@ Updating a Comment
An existing comment can be updated by sending a PATCH request to the URL of the comment. The request body needs to contain a JSON structure with at least a 'text' attribute:

.. http:example:: curl httpie python-requests
:request: _json/comments_update.req
:request: ../../src/plone/restapi/tests/http-examples/comments_update.req

The server will respond with a :term:`204 No Content` response and a location header with the comment URL when the comment has been updated successfully:

.. literalinclude:: _json/comments_update.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/comments_update.resp
:language: http


Expand All @@ -93,9 +93,9 @@ An existing comment can be deleted by sending a DELETE request to the URL of the
..note: Deleting a comment will, by default, also delete all existing replies to that comment.

.. http:example:: curl httpie python-requests
:request: _json/comments_delete.req
:request: ../../src/plone/restapi/tests/http-examples/comments_delete.req

When the comment has been deleted successfully, the server will respond with a :term:`204 No Content` response:

.. literalinclude:: _json/comments_delete.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/comments_delete.resp
:language: http
22 changes: 11 additions & 11 deletions docs/source/content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To create a new resource, we send a POST request to the resource container.
If we want to create a new document within an existing folder, we send a POST request to that folder:

.. http:example:: curl httpie python-requests
:request: _json/content_post.req
:request: ../../src/plone/restapi/tests/http-examples/content_post.req

By setting the 'Accept' header, we tell the server that we would like to receive the response in the 'application/json' representation format.

Expand All @@ -39,7 +39,7 @@ If a resource has been created, the server responds with the :term:`201 Created`
The 'Location' header contains the URL of the newly created resource and the resource representation in the payload:


.. literalinclude:: _json/content_post.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/content_post.resp
:language: http


Expand Down Expand Up @@ -110,7 +110,7 @@ Reading a Resource with GET
After a successful POST, we can access the resource by sending a GET request to the resource URL:

.. http:example:: curl httpie python-requests
:request: _json/content_get.req
:request: ../../src/plone/restapi/tests/http-examples/content_get.req

You can also set the `include_items` GET parameter to false if you don't want to include children.

Expand All @@ -120,7 +120,7 @@ Successful Response (200 OK)

If a resource has been retrieved successfully, the server responds with :term:`200 OK`:

.. literalinclude:: _json/content_get.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/content_get.resp
:language: http

.. note::
Expand Down Expand Up @@ -185,15 +185,15 @@ will be set. Note that this is not possible if the field is ``required``,
and it only works for Dexterity types, not Archetypes:

.. http:example:: curl httpie python-requests
:request: _json/content_patch.req
:request: ../../src/plone/restapi/tests/http-examples/content_patch.req


Successful Response (204 No Content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A successful response to a PATCH request will be indicated by a :term:`204 No Content` response by default:

.. literalinclude:: _json/content_patch.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/content_patch.resp
:language: http


Expand All @@ -204,9 +204,9 @@ You can get the object representation by adding a `Prefer` header with a value o
In this case, the response will be a :term:`200 OK`:

.. http:example:: curl httpie python-requests
:request: _json/content_patch_representation.req
:request: ../../src/plone/restapi/tests/http-examples/content_patch_representation.req

.. literalinclude:: _json/content_patch_representation.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/content_patch_representation.resp
:language: http

See for full specs the `RFC 5789: PATCH Method for HTTP <http://tools.ietf.org/html/rfc5789>`_
Expand Down Expand Up @@ -301,11 +301,11 @@ Removing a Resource with DELETE
We can delete an existing resource by sending a DELETE request:

.. http:example:: curl httpie python-requests
:request: _json/content_delete.req
:request: ../../src/plone/restapi/tests/http-examples/content_delete.req

A successful response will be indicated by a :term:`204 No Content` response:

.. literalinclude:: _json/content_delete.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/content_delete.resp
:language: http


Expand Down Expand Up @@ -358,4 +358,4 @@ A response 400 BadRequest with a message 'Client/server ordering mismatch' will
A response 400 BadRequest with a message 'Content ordering is not supported by this resource' will be returned if the container does not support ordering.

.. http:example:: curl httpie python-requests
:request: _json/content_reorder.req
:request: ../../src/plone/restapi/tests/http-examples/content_reorder.req
12 changes: 6 additions & 6 deletions docs/source/controlpanels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ A list of all existing control panels in the portal can be retrieved by
sending a GET request to the @controlpanels endpoint:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_get.req
:request: ../../src/plone/restapi/tests/http-examples/controlpanels_get.req

Response:

.. literalinclude:: _json/controlpanels_get.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/controlpanels_get.resp
:language: http

The following fields are returned:
Expand All @@ -43,11 +43,11 @@ To retrieve a single control panel, send a GET request to the URL of the
control panel:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_get_item.req
:request: ../../src/plone/restapi/tests/http-examples/controlpanels_get_item.req

Response:

.. literalinclude:: _json/controlpanels_get_item.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/controlpanels_get_item.resp
:language: http


Expand All @@ -67,11 +67,11 @@ To update the settings on a control panel send a PATCH request to control panel
resource:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_patch.req
:request: ../../src/plone/restapi/tests/http-examples/controlpanels_patch.req

A successful response to a PATCH request will be indicated by a :term:`204 No Content` response:

HTTP/1.1 204 No Content

.. literalinclude:: _json/controlpanels_patch.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/controlpanels_patch.resp
:language: http
12 changes: 6 additions & 6 deletions docs/source/copymove.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ destinations url with the source object specified in the request body. The sourc
object can be specified either by url, path, UID or intid.

.. http:example:: curl httpie python-requests
:request: _json/copy.req
:request: ../../src/plone/restapi/tests/http-examples/copy.req

If the copy operation succeeds, the server will respond with status 200 (OK) and return
the new and old url of the copied object.

.. literalinclude:: _json/copy.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/copy.resp
:language: http


Expand All @@ -26,12 +26,12 @@ destinations url with the source object specified in the request body. The sourc
object can be specified either by url, path, UID or intid.

.. http:example:: curl httpie python-requests
:request: _json/move.req
:request: ../../src/plone/restapi/tests/http-examples/move.req

If the move operation succeeds, the server will respond with status 200 (OK) and return
the new and old url of the moved object.

.. literalinclude:: _json/move.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/move.resp
:language: http


Expand All @@ -41,11 +41,11 @@ Copying/moving multiple objects
Multiple objects can be moved/copied by giving a list of sources.

.. http:example:: curl httpie python-requests
:request: _json/copy_multiple.req
:request: ../../src/plone/restapi/tests/http-examples/copy_multiple.req

If the operation succeeds, the server will respond with status 200 (OK) and return
the new and old urls for each copied/moved object.


.. literalinclude:: _json/copy_multiple.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/copy_multiple.resp
:language: http
12 changes: 6 additions & 6 deletions docs/source/expansion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ in the reponse of any content GET request::
Request Unexpanded:

.. http:example:: curl httpie python-requests
:request: _json/expansion.req
:request: ../../src/plone/restapi/tests/http-examples/expansion.req

Response Unexpanded:

.. literalinclude:: _json/expansion.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/expansion.resp
:language: http

In order to expand and embed one or more components, use the "expand" GET
Expand Down Expand Up @@ -87,19 +87,19 @@ component::
Request Expanded:

.. http:example:: curl httpie python-requests
:request: _json/expansion_expanded.req
:request: ../../src/plone/restapi/tests/http-examples/expansion_expanded.req

Response Expanded:

.. literalinclude:: _json/expansion_expanded.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/expansion_expanded.resp
:language: http

Here is an exaxmple of a request that expands all possible expansions:

.. http:example:: curl httpie python-requests
:request: _json/expansion_expanded_full.req
:request: ../../src/plone/restapi/tests/http-examples/expansion_expanded_full.req

And the response:

.. literalinclude:: _json/expansion_expanded_full.resp
.. literalinclude:: ../../src/plone/restapi/tests/http-examples/expansion_expanded_full.resp
:language: http
Loading