HTTP Methods

The persistence to the datastore is performed via HTTP methods as following:

Method Operation URL format Return Arguments
GET Fetch all objects for a class /{full-class-name} JSON Array of JSON objects
GET Fetch a single object. /{full-class-name}/{primary key} A JSON object The primary key field is passed in the URL path
GET Query objects. Returns a JSON Array of objects /{full-class-name}?{filter} JSON Array of JSON objects A JDO/JPA filter query
HEAD Validates if an object exists. /{full-class-name}/{primary key} The primary key field is passed in the URL path
PUT Update objects /{full-class-name}/{primary key} The JSON object is returned. If using application identity, with the primary key is included. The primary key field is passed in the URL path; The JSON Object is passed in the HTTP Content
POST Insert objects /{full-class-name} The JSON object is returned. If using application identity, with the primary key is included. The JSON Object is passed in the HTTP Content
DELETE delete object /{full-class-name}/{primary key} The primary key field is passed in the URL path
HTTP Methods samples
Fetch all objects of class guestbook.Greeting
GET http://datanucleus.appspot.com/dn/guestbook.Greeting

Response:

[{"author":null,
  "class":"guestbook.Greeting",
  "content":"test",
  "date":1239213624216,
  "id":1},
 {"author":null,
  "class":"guestbook.Greeting",
  "content":"test2",
  "date":1239213632286,
  "id":2}]
Fetch object with id 1 of class guestbook.Greeting
GET http://datanucleus.appspot.com/dn/guestbook.Greeting/1

Response:

{"author":null,
  "class":"guestbook.Greeting",
  "content":"test",
  "date":1239213624216,
  "id":1}
Fetch object using Application Primary Key Class
GET http://dnsamplemaps.appspot.com/dn/google.maps.Markers/{"class":"com.google.appengine.api.datastore.Key","id":1001,"kind":"Markers"}

Response:

{"class":"google.maps.Markers",
 "key":{"class":"com.google.appengine.api.datastore.Key",
        "id":1001,
        "kind":"Markers"
       },
 "markers":[
            {"class":"google.maps.Marker",
             "html":"Paris",
             "key":{"class":"com.google.appengine.api.datastore.Key",
                    "id":1,
                    "kind":"Marker",
                    "parent":{"class":"com.google.appengine.api.datastore.Key",
                              "id":1001,
                              "kind":"Markers"
                             }
                   },
             "lat":48.862222,
             "lng":2.351111
            }
           ]
}
Query object of class guestbook.Greeting
GET http://datanucleus.appspot.com/dn/guestbook.Greeting?content=='test'

Response:

[{"author":null,
  "class":"guestbook.Greeting",
  "content":"test",
  "date":1239213624216,
  "id":1}]
Insert a new object of class guestbook.Greeting
POST http://datanucleus.appspot.com/dn/guestbook.Greeting
{"author":null,
  "class":"guestbook.Greeting",
  "content":"test insert",
  "date":1239213923232}