Home

mreidy edited this page Jun 3, 2012 · 5 revisions
Clone this wiki locally

Creating an object... curl -X POST -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' https://api.parse.com/1/classes/Issue

Getting an object... curl -X GET -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" https://api.parse.com/1/classes/Issue/umn2BMDAot

Deleting an object... curl -X DELETE -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" https://api.parse.com/1/classes/Issue/umn2BMDAot

Get all... curl -X GET -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" https://api.parse.com/1/classes/Issue

Get an issue based on a GeoQuery:

Return 10 issues sorted by distance curl -X GET -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -G --data-urlencode 'limit=10' --data-urlencode 'where={"location": {"$nearSphere": {"__type": "GeoPoint","latitude": 90.0,"longitude": -90.0 }}}' https://api.parse.com/1/classes/Issue

Return 10 issues sorted by distance - but limited to within a 10km radius curl -X GET -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -G --data-urlencode 'limit=10' --data-urlencode 'where={"location": {"$nearSphere": {"__type": "GeoPoint","latitude": 90.0,"longitude": -90.0 },"$maxDistanceInKilometers": 10.0 }}' https://api.parse.com/1/classes/Issue

Issue: { "title":"Tree across the road", "notes":"This is stopping me from getting home", "resolved":true, "location": { "__type": "GeoPoint", "latitude": 40.0, "longitude": -30.0 }, "category":"Tree Down", "timestamp": { "__type": "Date", "iso": "2011-08-21T18:02:52.249Z" }, "photos": [ { "__type": "Pointer", "className": "Photo", "objectId": "RizQRK8pGt" }, { "__type": "Pointer", "className": "Photo", "objectId": "RizQRK8pGt" } ], "resolution_photo":{ "__type": "Pointer", "className": "Photo", "objectId": "RizQRK8pGt" }, "static_map":{ "__type": "Pointer", "className": "Map", "objectId": "HVFOxYmPlq" } }

Photo: { "image":{ "__type": "Bytes", "base64": "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==" } }

Map: { "image":{ "__type": "Bytes", "base64": "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==" } }

  • Test fixture data for flodding at Woodend:

curl -X POST -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -H "Content-Type: application/json" -d '{ "title":"Fence down", "notes":"This is stopping me from getting home", "resolved":false, "location": { "__type": "GeoPoint", "latitude": -37.36633719814675, "longitude": 144.57321166992188 }, "category":"Fencing", "timestamp": { "__type": "Date", "iso": "2012-06-02T11:02:52.249Z" } }' https://api.parse.com/1/classes/Issue && curl -X POST -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -H "Content-Type: application/json" -d '{ "title":"Mild flooding", "notes":"This is stopping me from getting out of town", "resolved":false, "location": { "__type": "GeoPoint", "latitude": -37.32867264506216, "longitude": 144.5862579345703 }, "category":"Flooding", "timestamp": { "__type": "Date", "iso": "2012-06-02T09:02:52.249Z" } }' https://api.parse.com/1/classes/Issue && curl -X POST -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -H "Content-Type: application/json" -d '{ "title":"Severe flooding over road", "notes":"This is stopping me from getting around town", "resolved":false, "location": { "__type": "GeoPoint", "latitude": -37.37534113954815, "longitude": 144.54952239990234 }, "category":"Flooding", "timestamp": { "__type": "Date", "iso": "2012-06-02T08:42:52.249Z" } }' https://api.parse.com/1/classes/Issue && curl -X POST -H "X-Parse-Application-Id: lGZqd3iRqUPZCEjwmWDp4EKWV1dd0xofryNY4TuB" -H "X-Parse-REST-API-Key: QwfvNEkNjAOEXeydTbwkCdaI2RdAQoQKfUlImEVH" -H "Content-Type: application/json" -d '{ "title":"Livestock loose", "notes":"Unable to get around town", "resolved":false, "location": { "__type": "GeoPoint", "latitude": -37.38332100230859, "longitude": 144.52523231506348 }, "category":"Livestock", "timestamp": { "__type": "Date", "iso": "2012-06-02T08:52:52.249Z" } } ' https://api.parse.com/1/classes/Issue