Skip to content

Commit

Permalink
Adds reminder in docs about resource ID as string
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Apr 2, 2016
1 parent fabd7e4 commit a649b7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ request::
manager.create_api(Person, preprocessors=preprocessors)

For preprocessors for endpoints of the form ``/api/person/1``, a returned value
will be interpreted as the resource ID for the request. For example, if a
will be interpreted as the resource ID for the request. (Remember, as described
in :ref:`idstring`, the returned ID must be a string.) For example, if a
preprocessor for a :http:method:`get` request to ``/api/person/1`` returns the
string ``'foo'``, then Flask-Restless will behave as if the request were
originally for the URL ``/api/person/foo``. For preprocessors for endpoints of
Expand Down
13 changes: 13 additions & 0 deletions docs/requestformat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ specification.
updating
updatingrelationships

.. _idstring:

Resource ID must be a string
----------------------------

As required by the JSON API, the ID (and type) of a resource must be a string
in request and response documents. This does *not* mean that the primary key in
the database must be a string, only that it will appear as a string in
communications between the client and the server. For more information, see the
`Identification`_ section of the JSON API specification.

.. _Identification: http://jsonapi.org/format/#document-resource-object-identification

.. _slashes:

Trailing slashes in URLs
Expand Down

0 comments on commit a649b7a

Please sign in to comment.