Skip to content

Commit d88ba98

Browse files
authored
Add Accept header to curl example in ocs-api-overview.rst
The return type of ocs calls can easily be changed by adding an Accept header to the request. Since some ocs calls return xml as their default, while others return json, it might be beneficial to the reader to state this early in the documentation. Signed-off-by: sunetfreitag <[email protected]>
1 parent 64bbf50 commit d88ba98

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

developer_manual/client_apis/OCS/ocs-api-overview.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ For example: you can perform a :code:`GET` request to get information about a us
3737
3838
curl -u username:password -X GET 'https://cloud.example.com/ocs/v1.php/...' -H "OCS-APIRequest: true"
3939
40+
You can change the response type of your request by adding an Accept header. For example, if you prefer JSON respones:
41+
42+
.. code-block:: bash
43+
44+
curl -u username:password -X GET 'https://cloud.example.com/ocs/v1.php/...' -H "Accept: application/json" -H "OCS-APIRequest: true"
45+
46+
Adding the Accept header also ensures consistency of your responses, since some legacy OCS requests return XML as their default response, while newer requests return JSON.
4047

4148
User metadata
4249
-------------

0 commit comments

Comments
 (0)