HTTP Mapping

The persistence to JSON datastore is performed via HTTP methods. HTTP response codes are used to validate the success or failure to perform the operations. The JSON datastore must respect the following:

Method Operation URL format HTTP response code
PUT update objects /{primary key} HTTP Code 201 (created), 200 (ok) or 204 (no content)
HEAD locate objects /{primary key} HTTP 404 if the object does not exist
POST insert objects / HTTP Code 201 (created), 200 (ok) or 204 (no content)
GET fetch objects /{primary key} HTTP Code 200 (ok) or 404 if object does not exist
GET retrieve extent of classes (set of objects) / HTTP Code 200 (ok) or 404 if no objects exist
DELETE delete objects /{primary key} HTTP Code 202 (accepted), 200 (ok) or 204 (no content)
Persistent Classes Mapping
Metadata API Extension Element Attachment Extension Description
JDO /jdo/package/class/extension url Defines the location of the resources/objects for the class
<jdo>
    <package name="org.datanucleus.samples.models.company">
        <class name="Person" detachable="true">
            <extension vendor-name="datanucleus" key="url" value="/Person"/>
        </class>
    </package>
</jdo>

In this example, the url extension identifies the Person resources/objects as /Person . The persistence operations will be relative to this path. e.g /Person/{primary key} will be used for PUT (update), GET (fetch) and DELETE (delete) methods.