-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into barcelona-mocks
Conflicts: src/plone/restapi/tests/test_documentation.py
- Loading branch information
Showing
54 changed files
with
560 additions
and
1,811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
GET /plone/front-page/workflow | ||
Accept: application/json | ||
|
||
HTTP 200 OK | ||
content-type: application/json | ||
|
||
{ | ||
"history": [ | ||
{ | ||
"action": null, | ||
"actor": "test_user_1_", | ||
"comments": "", | ||
"review_state": "private", | ||
"time": "2016-05-16T13:42:42+00:00" | ||
} | ||
], | ||
"transitions": [ | ||
{ | ||
"@id": "http://localhost:55001/plone/front-page/workflow/publish", | ||
"title": "Publish" | ||
}, | ||
{ | ||
"@id": "http://localhost:55001/plone/front-page/workflow/submit", | ||
"title": "Submit for publication" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
POST /plone/front-page/workflow/publish | ||
Accept: application/json | ||
|
||
HTTP 200 OK | ||
content-type: application/json | ||
|
||
{ | ||
"action": "publish", | ||
"actor": "admin", | ||
"comments": "", | ||
"review_state": "published", | ||
"time": "2016-05-16T13:42:42+00:00" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
============== | ||
Authentication | ||
============== | ||
|
||
``plone.restapi`` uses Plone PAS for Authentication. | ||
|
||
That means that any authentication method supported by an installed PAS Plugin | ||
should work, assuming it's an authentication method that makes sense to use | ||
with an API. | ||
|
||
For example, to authenticate using HTTP basic auth, you'd set an | ||
``Authorization`` header: | ||
|
||
.. code:: | ||
GET /Plone HTTP/1.1 | ||
Authorization: Basic Zm9vYmFyOmZvb2Jhcgo= | ||
Accept: application/json | ||
HTTP client libraries usually contain helper functions to produce a proper | ||
``Authorization`` header for you based on given credentials. | ||
|
||
Using the ``requests`` library, you'd set up a session with basic auth like | ||
this: | ||
|
||
.. code:: python | ||
import requests | ||
session = requests.Session() | ||
session.auth = ('username', 'password') | ||
session.headers.update({'Accept': 'application/json'}) | ||
response = session.get(url) | ||
Or the same example using ``curl``: | ||
|
||
.. code:: python | ||
curl -u username:password -H 'Accept:application/json' $URL |
Oops, something went wrong.