From 15a88a9d36a692d30268b10e6c4ce112ca439e8d Mon Sep 17 00:00:00 2001 From: Niko Diamadis Date: Sun, 7 Aug 2022 11:38:50 +0200 Subject: [PATCH 1/3] Update REST API Python examples --- _includes/rest/analytics.md | 27 ++-- _includes/rest/cloud-code.md | 18 ++- _includes/rest/config.md | 9 +- _includes/rest/files.md | 36 +++-- _includes/rest/geopoints.md | 33 +++-- _includes/rest/hooks.md | 144 ++++++++++++------- _includes/rest/objects.md | 124 ++++++++++------ _includes/rest/push-notifications.md | 207 ++++++++++++++++++--------- _includes/rest/queries.md | 207 ++++++++++++++------------- _includes/rest/roles.md | 72 ++++++---- _includes/rest/schemas.md | 63 +++++--- _includes/rest/sessions.md | 63 +++++--- _includes/rest/users.md | 114 ++++++++++----- 13 files changed, 704 insertions(+), 413 deletions(-) diff --git a/_includes/rest/analytics.md b/_includes/rest/analytics.md index 1158ab46b..4a023e88f 100644 --- a/_includes/rest/analytics.md +++ b/_includes/rest/analytics.md @@ -34,8 +34,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/events/AppOpened

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/events/AppOpened', json.dumps({
      }), {
@@ -44,7 +47,7 @@ connection.request('POST', '/parse/
@@ -73,8 +76,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/events/Search

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/events/Search', json.dumps({
        "dimensions": {
@@ -88,7 +94,7 @@ connection.request('POST', '/parse/
@@ -108,8 +114,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/events/Error

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/events/Error', json.dumps({
        "dimensions": {
@@ -121,7 +130,7 @@ connection.request('POST', '/parse/
diff --git a/_includes/rest/cloud-code.md b/_includes/rest/cloud-code.md index 6ef8b69c7..9f8ad4118 100644 --- a/_includes/rest/cloud-code.md +++ b/_includes/rest/cloud-code.md @@ -15,8 +15,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/functions/hello

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/functions/hello', json.dumps({
      }), {
@@ -25,7 +28,7 @@ connection.request('POST', '/parse/
@@ -47,8 +50,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/jobs/userMigration

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/jobs/userMigration', json.dumps({
        "plan": "paid"
@@ -58,6 +64,6 @@ connection.request('POST', '/parse/
diff --git a/_includes/rest/config.md b/_includes/rest/config.md index 29587462a..133e73eaa 100644 --- a/_includes/rest/config.md +++ b/_includes/rest/config.md @@ -14,15 +14,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/config

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/config', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/files.md b/_includes/rest/files.md index 1022ed7b5..c306e3100 100644 --- a/_includes/rest/files.md +++ b/_includes/rest/files.md @@ -14,8 +14,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/files/hello.txt

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/files/hello.txt', 'Hello, World!', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -23,7 +26,7 @@ connection.request('POST', '/parse/
@@ -55,8 +58,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/files/pic.jpg

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/files/pic.jpg', open('myPicture.jpg', 'rb').read(), {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -64,7 +70,7 @@ connection.request('POST', '/parse/
@@ -89,8 +95,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PlayerProfile

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/classes/PlayerProfile', json.dumps({
        "name": "Andrew",
@@ -105,7 +114,7 @@ connection.request('POST', '/parse/
@@ -124,15 +133,18 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/files/...profile.png

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/files/...profile.png', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-Master-Key": "${MASTER_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/geopoints.md b/_includes/rest/geopoints.md index 18addebf2..3413b5169 100644 --- a/_includes/rest/geopoints.md +++ b/_includes/rest/geopoints.md @@ -22,8 +22,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PlaceObject

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/classes/PlaceObject', json.dumps({
        "location": {
@@ -37,7 +40,7 @@ connection.request('POST', '/parse/
@@ -64,8 +67,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PlaceObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"limit":10,"where":json.dumps({
        "location": {
          "$nearSphere": {
@@ -81,7 +84,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -135,8 +138,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PlaceObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "location": {
          "$nearSphere": {
@@ -153,7 +156,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -186,8 +189,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PizzaPlaceObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "location": {
          "$within": {
@@ -212,7 +215,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -252,8 +255,8 @@ curl -X GET \ https://api.parse.com/1/classes/PizzaPlaceObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('api.parse.com', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('api.parse.com', 443)
 params = urllib.urlencode({"where":json.dumps({
        "location": {
          "$geoWithin": {
@@ -283,7 +286,7 @@ connection.request('GET', '/1/classes/PizzaPlaceObject?%s' % params, '', {
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/hooks.md b/_includes/rest/hooks.md index 0db8f4a37..0eafe393b 100644 --- a/_includes/rest/hooks.md +++ b/_includes/rest/hooks.md @@ -60,8 +60,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/hooks/functions', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -69,7 +72,7 @@ connection.request('GET', '/parse/
@@ -97,8 +100,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions/sendMessage

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/hooks/functions/sendMessage', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -106,7 +112,7 @@ connection.request('GET', '/parse/
@@ -133,8 +139,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/hooks/triggers', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -142,7 +151,7 @@ connection.request('GET', '/parse/
@@ -178,8 +187,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers/Scores/beforeSave

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/hooks/triggers/Scores/beforeSave', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -187,7 +199,7 @@ connection.request('GET', '/parse/
@@ -238,8 +250,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/hooks/functions', json.dumps(
        {"functionName":"baz","url":"https://api.example.com/baz"}
@@ -249,7 +264,7 @@ connection.request('POST', '/parse/
@@ -275,8 +290,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/hooks/functions', json.dumps(
        {"functionName":"bar","url":"https://api.example.com/bar"}
@@ -286,7 +304,7 @@ connection.request('POST', '/parse/
@@ -324,8 +342,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/hooks/triggers', json.dumps(
        {"className": "Game", "triggerName": "beforeSave", "url": "https://api.example.com/Game/beforeSave"}
@@ -335,7 +356,7 @@ connection.request('POST', '/parse/
@@ -365,8 +386,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/hooks/triggers', json.dumps(
        {"className": "Tournament", "triggerName": "beforeDelete", "url": "https://api.example.com/Scores/beforeDelete"}
@@ -376,7 +400,7 @@ connection.request('POST', '/parse/
@@ -406,8 +430,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions/baz

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/functions/baz', json.dumps(
     {"url":"https://api.example.com/_baz"}
@@ -417,7 +444,7 @@ connection.request('PUT', '/parse/
@@ -443,8 +470,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions/bar

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/functions/bar', json.dumps(
       {"url":"https://api.example.com/_bar"}
@@ -454,7 +484,7 @@ connection.request('PUT', '/parse/
@@ -481,8 +511,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers/Game/beforeSave

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps(
       {"url": "https://api.example.com/Game/_beforeSave"}
@@ -492,7 +525,7 @@ connection.request('PUT', '/parse/
@@ -522,8 +555,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers/Tournament/beforeDelete

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps(
       {"url": "https://api.example.com/Scores/beforeDelete"}
@@ -533,7 +569,7 @@ connection.request('PUT', '/parse/
@@ -561,8 +597,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions/foo

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/functions/foo', json.dumps(
       {"__op": "Delete"}
@@ -572,7 +611,7 @@ connection.request('PUT', '/parse/
@@ -595,8 +634,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/functions/sendMessage

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/functions/sendMessage', json.dumps(
       {"__op": "Delete"}
@@ -606,7 +648,7 @@ connection.request('PUT', '/parse/
@@ -629,8 +671,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers/Game/beforeSave

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps(
       {"__op": "Delete"}
@@ -640,7 +685,7 @@ connection.request('PUT', '/parse/
@@ -663,8 +708,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/hooks/triggers/Tournament/beforeDelete

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps(
       {"__op": "Delete"}
@@ -674,7 +722,7 @@ connection.request('PUT', '/parse/
diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md index cadebea36..e168d8e94 100644 --- a/_includes/rest/objects.md +++ b/_includes/rest/objects.md @@ -66,8 +66,11 @@ To create a new object on Parse, send a POST request to the class URL containing https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/classes/GameScore', json.dumps({
        "score": 1337,
@@ -111,15 +114,18 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
 

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -152,8 +158,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"include":"game"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
@@ -161,7 +167,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -179,8 +185,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"include":"game","readPreference":"SECONDARY","includeReadPreference":"SECONDARY_PREFERRED"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
@@ -188,7 +194,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -208,8 +214,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "score": 73453
@@ -219,7 +228,7 @@ connection.request('PUT', '/parse/
@@ -245,8 +254,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "score": {
@@ -259,7 +271,7 @@ connection.request('PUT', '/parse/
@@ -275,8 +287,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "score": {
@@ -289,7 +304,7 @@ connection.request('PUT', '/parse/
@@ -313,8 +328,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "skills": {
@@ -330,7 +348,7 @@ connection.request('PUT', '/parse/
@@ -348,8 +366,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "opponents": {
@@ -368,7 +389,7 @@ connection.request('PUT', '/parse/
@@ -384,8 +405,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "opponents": {
@@ -404,7 +428,7 @@ connection.request('PUT', '/parse/
@@ -420,15 +444,18 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/classes/GameScore/Ed1nuqPvcm', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -444,8 +471,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({
        "opponents": {
@@ -457,7 +487,7 @@ connection.request('PUT', '/parse/
@@ -496,8 +526,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/batch

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/batch', json.dumps({
        "requests": [
@@ -524,7 +557,7 @@ connection.request('POST', '/parse/
@@ -576,8 +609,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/batch

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/batch', json.dumps({
        "requests": [
@@ -599,7 +635,7 @@ connection.request('POST', '/parse/
@@ -641,8 +677,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "createdAt": {
          "$gte": {
@@ -657,7 +693,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/push-notifications.md b/_includes/rest/push-notifications.md index 46fb7fb22..b8a3db354 100644 --- a/_includes/rest/push-notifications.md +++ b/_includes/rest/push-notifications.md @@ -43,8 +43,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/installations

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/installations', json.dumps({
        "deviceType": "ios",
@@ -58,7 +61,7 @@ connection.request('POST', '/parse/
@@ -103,8 +106,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/installations

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/installations', json.dumps({
        "deviceType": "android",
@@ -119,7 +125,7 @@ connection.request('POST', '/parse/
@@ -135,15 +141,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/installations/mrmBZvsErB', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -183,8 +192,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({
        "deviceType": "ios",
@@ -199,7 +211,7 @@ connection.request('PUT', '/parse/
@@ -219,15 +231,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/installations

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/installations', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-Master-Key": "${MASTER_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -275,15 +290,18 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/installations/mrmBZvsErB', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-Master-Key": "${MASTER_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -317,8 +335,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({
        "channels": [
@@ -330,7 +351,7 @@ connection.request('PUT', '/parse/
@@ -362,8 +383,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "channels": [
@@ -379,7 +403,7 @@ connection.request('POST', '/parse/
@@ -407,8 +431,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({
        "scores": True,
@@ -420,7 +447,7 @@ connection.request('PUT', '/parse/
@@ -442,8 +469,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/installations/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({
        "user": {
@@ -457,7 +487,7 @@ connection.request('PUT', '/parse/
@@ -482,8 +512,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -498,7 +531,7 @@ connection.request('POST', '/parse/
@@ -522,8 +555,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -539,7 +575,7 @@ connection.request('POST', '/parse/
@@ -573,8 +609,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -603,7 +642,7 @@ connection.request('POST', '/parse/
@@ -649,8 +688,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "channels": [
@@ -668,7 +710,7 @@ connection.request('POST', '/parse/
@@ -678,8 +720,11 @@ It is also possible to specify your own data in this dictionary. As explained in

 

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "channels": [
@@ -697,7 +742,7 @@ connection.request('POST', '/parse/
@@ -722,8 +767,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "expiration_time": "2015-03-19T22:05:08Z",
@@ -736,7 +784,7 @@ connection.request('POST', '/parse/
@@ -758,8 +806,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "push_time": "2015-03-13T22:05:08Z",
@@ -773,7 +824,7 @@ connection.request('POST', '/parse/
@@ -800,8 +851,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -816,7 +870,7 @@ connection.request('POST', '/parse/
@@ -837,8 +891,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -853,7 +910,7 @@ connection.request('POST', '/parse/
@@ -874,8 +931,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -890,7 +950,7 @@ connection.request('POST', '/parse/
@@ -911,8 +971,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -927,7 +990,7 @@ connection.request('POST', '/parse/
@@ -953,8 +1016,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/push

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/push', json.dumps({
        "where": {
@@ -970,7 +1036,7 @@ connection.request('POST', '/parse/
@@ -1007,8 +1073,11 @@ curl -X POST \ https://api.parse.com/1/push

-import json,httplib
-connection = httplib.HTTPSConnection('api.parse.com', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('api.parse.com', 443)
 connection.connect()
 connection.request('POST', '/1/push', json.dumps({
        "data": {
@@ -1021,7 +1090,7 @@ connection.request('POST', '/1/push', json.dumps({
        "Content-Type": "application/json"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/queries.md b/_includes/rest/queries.md index 027f1aadd..774f092ac 100644 --- a/_includes/rest/queries.md +++ b/_includes/rest/queries.md @@ -12,15 +12,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -63,8 +66,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "playerName": "Sean Plott",
        "cheatMode": False
@@ -75,7 +78,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -109,8 +112,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "score": {
          "$gte": 1000,
@@ -123,7 +126,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -139,8 +142,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "score": {
          "$in": [
@@ -158,7 +161,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -182,8 +185,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "playerName": {
          "$nin": [
@@ -199,7 +202,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -215,8 +218,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "score": {
          "$exists": True
@@ -228,7 +231,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -244,8 +247,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "score": {
          "$exists": False
@@ -257,7 +260,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -273,8 +276,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/_User

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "hometown": {
          "$select": {
@@ -296,7 +299,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -323,8 +326,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"order":"score"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
@@ -332,7 +335,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -348,8 +351,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"order":"-score"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
@@ -357,7 +360,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -373,8 +376,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"order":"score,-name"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
@@ -382,7 +385,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -399,8 +402,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"limit":200,"skip":400})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
@@ -408,7 +411,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -426,8 +429,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"keys":"[score,playerName]"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
@@ -435,7 +438,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -451,8 +454,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"excludeKeys":"playerName"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
@@ -460,7 +463,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -488,8 +491,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({
     "where":json.dumps({
       "playerName": {
@@ -510,7 +513,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -529,8 +532,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/RandomObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "arrayKey": 2
      })})
@@ -540,7 +543,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -556,8 +559,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/RandomObject

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "arrayKey": {
          "$all": [
@@ -573,7 +576,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -593,8 +596,8 @@ curl -X GET \

 # Finds barbecue sauces that start with "Big Daddy"
-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "name": {
          "$regex": "^Big Daddy"
@@ -606,7 +609,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -649,8 +652,8 @@ curl -X GET \

 # Finds barbecue sauces that contains "Daddy"
-import json,httplib,urllib
-connection = httplib.HTTPSConnection('api.parse.com', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('api.parse.com', 443)
 params = urllib.urlencode({"where":json.dumps({
        "name": {
          "$text": {
@@ -666,7 +669,7 @@ connection.request('GET', '/1/classes/BarbecueSauce?%s' % params, '', {
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -686,8 +689,8 @@ curl -X GET \

 # Finds string that contains "Daddy" ordered by relevance
-import json,httplib,urllib
-connection = httplib.HTTPSConnection('api.parse.com', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('api.parse.com', 443)
 params = urllib.urlencode({"where":json.dumps({
        "name": {
          "$text": {
@@ -706,7 +709,7 @@ connection.request('GET', '/1/classes/BarbecueSauce?%s' % params, '', {
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -726,8 +729,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "post": {
          "__type": "Pointer",
@@ -741,7 +744,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -757,8 +760,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "post": {
          "$inQuery": {
@@ -777,7 +780,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -793,8 +796,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "post": {
          "$notInQuery": {
@@ -813,7 +816,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -829,8 +832,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/users

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "$relatedTo": {
          "object": {
@@ -847,7 +850,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -865,8 +868,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"order":"-createdAt","limit":10,"include":"post"})
 connection.connect()
 connection.request('GET', '/parse/classes/Comment?%s' % params, '', {
@@ -874,7 +877,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -915,8 +918,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"order":"-createdAt","limit":10,"include":"post.author"})
 connection.connect()
 connection.request('GET', '/parse/classes/Comment?%s' % params, '', {
@@ -924,7 +927,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -948,8 +951,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "playerName": "Jonathan Walsh"
      }),"count":1,"limit":0})
@@ -959,7 +962,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -988,8 +991,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Player

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "$or": [
          {
@@ -1010,7 +1013,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1035,8 +1038,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/aggregate/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"distinct":"score"})
 connection.connect()
 connection.request('GET', '/parse/aggregate/GameScore?%s' % params, '', {
@@ -1045,7 +1048,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1062,8 +1065,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/aggregate/GameScore

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"where":json.dumps({
        "playerName": "Sean Plott"
      }),"distinct":"score"})
@@ -1074,7 +1077,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1105,8 +1108,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"group":json.dumps({
        "objectId": null,
        "total": {
@@ -1120,7 +1123,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1137,8 +1140,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"project":json.dumps({
        "score": 1
      })})
@@ -1149,7 +1152,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1166,8 +1169,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"match":json.dumps({
        "score": {
         "$gt":15
@@ -1180,7 +1183,7 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -1204,8 +1207,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({
   "where":json.dumps({
     "post": {
@@ -1230,6 +1233,6 @@ connection.request('GET', '/parse/${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
diff --git a/_includes/rest/roles.md b/_includes/rest/roles.md index 568dde69a..b65a219dc 100644 --- a/_includes/rest/roles.md +++ b/_includes/rest/roles.md @@ -35,8 +35,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/roles

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/roles', json.dumps({
        "name": "Moderators",
@@ -51,7 +54,7 @@ connection.request('POST', '/parse/
@@ -94,8 +97,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/roles

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/roles', json.dumps({
        "name": "Moderators",
@@ -130,7 +136,7 @@ connection.request('POST', '/parse/
@@ -162,15 +168,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/roles/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/roles/mrmBZvsErB', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -228,8 +237,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/roles/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/roles/mrmBZvsErB', json.dumps({
        "users": {
@@ -253,7 +265,7 @@ connection.request('PUT', '/parse/
@@ -280,8 +292,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/roles/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/roles/mrmBZvsErB', json.dumps({
        "roles": {
@@ -300,7 +315,7 @@ connection.request('PUT', '/parse/
@@ -319,15 +334,18 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/roles/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/roles/mrmBZvsErB', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-Master-Key": "${MASTER_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -342,8 +360,11 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/roles/mrmBZvsErB

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/roles/mrmBZvsErB', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -351,7 +372,7 @@ connection.request('DELETE', '/parse/
@@ -406,8 +427,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/roles/<ModeratorsRoleObjectId>

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/roles/<ModeratorsRoleObjectId>', json.dumps({
        "roles": {
@@ -426,5 +450,5 @@ connection.request('PUT', '/parse/
diff --git a/_includes/rest/schemas.md b/_includes/rest/schemas.md index 7925ff66a..5296ac7fc 100644 --- a/_includes/rest/schemas.md +++ b/_includes/rest/schemas.md @@ -26,8 +26,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/schemas

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/schemas', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -35,7 +38,7 @@ connection.request('GET', '/parse/
@@ -83,8 +86,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/schemas/Game

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/schemas/Game', "", {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -92,7 +98,7 @@ connection.request('GET', '/parse/
@@ -119,8 +125,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/schemas/City

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/schemas/City', json.dumps({
        "className":"City","fields":{"name":{"type":"String"} }
@@ -130,7 +139,7 @@ connection.request('POST', '/parse/
@@ -159,8 +168,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/schemas/City

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/schemas/City', json.dumps({
        "className":"City","fields":{"name":{"type":"String"},"indexes":{"indexName":{"name":1} }
@@ -170,7 +182,7 @@ connection.request('POST', '/parse/
@@ -201,8 +213,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/schemas/City

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/schemas/City', json.dumps(
        "className":"City","fields":{"population":{"type":"Number"},"indexes":{"population_index":{"population":1} }
@@ -212,7 +227,7 @@ connection.request('PUT', '/parse/
@@ -241,8 +256,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/schemas/City

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/schemas/City', json.dumps(
        "className":"City","fields":{"population":{"__op" : "Delete"},"indexes":{"population_index":{"__op" : "Delete"} }
@@ -252,7 +270,7 @@ connection.request('PUT', '/parse/
@@ -270,8 +288,11 @@ curl -X DELETE\ https://YOUR.PARSE-SERVER.HERE/parse/schemas/City

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/schemas/City', "", {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -279,5 +300,5 @@ connection.request('PUT', '/parse/
diff --git a/_includes/rest/sessions.md b/_includes/rest/sessions.md index bd5f135ea..0ca7c5036 100644 --- a/_includes/rest/sessions.md +++ b/_includes/rest/sessions.md @@ -45,8 +45,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/sessions/Axy98kq1B09

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/sessions/Axy98kq1B09', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -54,7 +57,7 @@ connection.request('GET', '/parse/
@@ -69,8 +72,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/sessions/me

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/sessions/me', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -78,7 +84,7 @@ connection.request('GET', '/parse/
@@ -97,8 +103,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/sessions/Axy98kq1B09

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/logout', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -106,7 +115,7 @@ connection.request('POST', '/parse/
@@ -123,8 +132,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/sessions

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/sessions', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -132,7 +144,7 @@ connection.request('GET', '/parse/
@@ -149,8 +161,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/logout

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/logout', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -158,7 +173,7 @@ connection.request('POST', '/parse/
@@ -173,8 +188,11 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/sessions/Axy98kq1B09

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/sessions/Axy98kq1B09', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -182,7 +200,7 @@ connection.request('DELETE', '/parse/
@@ -211,8 +229,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/sessions/me

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/sessions/me', json.dumps({
      }), {
@@ -222,7 +243,7 @@ connection.request('PUT', '/parse/
diff --git a/_includes/rest/users.md b/_includes/rest/users.md index e08c8b1dd..614c77696 100644 --- a/_includes/rest/users.md +++ b/_includes/rest/users.md @@ -23,8 +23,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/users

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/users', json.dumps({
        "username": "cooldude6",
@@ -37,7 +40,7 @@ connection.request('POST', '/parse/
@@ -74,8 +77,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/login

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/login', json.dumps({
        "username": "cooldude6",
@@ -87,7 +93,7 @@ connection.request('POST', '/parse/
@@ -126,8 +132,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/verificationEmailRequest

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/verificationEmailRequest', json.dumps({
        "email": "email@example.com"
@@ -137,7 +146,7 @@ connection.request('POST', '/parse/
@@ -157,8 +166,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/requestPasswordReset

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/requestPasswordReset', json.dumps({
        "email": "coolguy@iloveapps.com"
@@ -168,7 +180,7 @@ connection.request('POST', '/parse/
@@ -186,15 +198,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/users/g7y9tkhB7O

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/users/g7y9tkhB7O', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -223,8 +238,11 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/users/me

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/users/me', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -232,7 +250,7 @@ connection.request('GET', '/parse/
@@ -264,8 +282,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/users/g7y9tkhB7O

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/users/g7y9tkhB7O', json.dumps({
        "phone": "415-369-6201"
@@ -276,7 +297,7 @@ connection.request('PUT', '/parse/
@@ -300,15 +321,18 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/users

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('GET', '/parse/users', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
        "X-Parse-REST-API-Key": "${REST_API_KEY}"
      })
 result = json.loads(connection.getresponse().read())
-print result
+print(result)
 
@@ -350,8 +374,11 @@ curl -X DELETE \ https://YOUR.PARSE-SERVER.HERE/parse/users/g7y9tkhB7O

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('DELETE', '/parse/users/g7y9tkhB7O', '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -359,7 +386,7 @@ connection.request('DELETE', '/parse/
@@ -436,8 +463,11 @@ curl -X POST \ https://YOUR.PARSE-SERVER.HERE/parse/users

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('POST', '/parse/users', json.dumps({
        "authData": {
@@ -457,7 +487,7 @@ connection.request('POST', '/parse/
@@ -531,8 +561,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/users/uMz0YZeAqc

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/users/uMz0YZeAqc', json.dumps({
        "authData": {
@@ -549,7 +582,7 @@ connection.request('PUT', '/parse/
@@ -574,8 +607,11 @@ curl -X PUT \ https://YOUR.PARSE-SERVER.HERE/parse/users/uMz0YZeAqc

-import json,httplib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import http.client
+import json
+
+
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
 connection.request('PUT', '/parse/users/uMz0YZeAqc', json.dumps({
        "authData": {
@@ -588,7 +624,7 @@ connection.request('PUT', '/parse/
@@ -639,8 +675,8 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/loginAs

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+import json,http.client,urllib
+connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 params = urllib.urlencode({"userId":"abc123"})
 connection.connect()
 connection.request('GET', '/parse/loginAs?%s' % params, '', {
@@ -650,7 +686,7 @@ connection.request('GET', '/parse/
From b9183b55c0e92dd13e0cf69da01bcebfbfda4678 Mon Sep 17 00:00:00 2001 From: Niko Diamadis Date: Sun, 7 Aug 2022 12:09:52 +0200 Subject: [PATCH 2/3] Update REST API urllib python examples --- _includes/rest/geopoints.md | 32 +++-- _includes/rest/objects.md | 24 +++- _includes/rest/queries.md | 268 +++++++++++++++++++++++++++--------- _includes/rest/users.md | 8 +- 4 files changed, 248 insertions(+), 84 deletions(-) diff --git a/_includes/rest/geopoints.md b/_includes/rest/geopoints.md index 3413b5169..afec9c734 100644 --- a/_includes/rest/geopoints.md +++ b/_includes/rest/geopoints.md @@ -67,9 +67,13 @@ curl -X GET \ https://YOUR.PARSE-SERVER.HERE/parse/classes/PlaceObject

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"limit":10,"where":json.dumps({
+params = urllib.parse.urlencode({"limit": 10, "where": json.dumps({
        "location": {
          "$nearSphere": {
            "__type": "GeoPoint",
@@ -138,9 +142,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/PlaceObject
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "location": {
          "$nearSphere": {
            "__type": "GeoPoint",
@@ -189,9 +197,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/PizzaPlaceObject
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "location": {
          "$within": {
            "$box": [
@@ -255,9 +267,13 @@ curl -X GET \
   https://api.parse.com/1/classes/PizzaPlaceObject
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('api.parse.com', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "location": {
          "$geoWithin": {
             "$polygon": [
diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md
index e168d8e94..4c01d134c 100644
--- a/_includes/rest/objects.md
+++ b/_includes/rest/objects.md
@@ -158,9 +158,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"include":"game"})
+params = urllib.parse.urlencode({"include": "game"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -185,9 +189,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"include":"game","readPreference":"SECONDARY","includeReadPreference":"SECONDARY_PREFERRED"})
+params = urllib.parse.urlencode({"include": "game", "readPreference": "SECONDARY", "includeReadPreference": "SECONDARY_PREFERRED"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -677,9 +685,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "createdAt": {
          "$gte": {
            "__type": "Date",
diff --git a/_includes/rest/queries.md b/_includes/rest/queries.md
index 774f092ac..96d4bc8c3 100644
--- a/_includes/rest/queries.md
+++ b/_includes/rest/queries.md
@@ -66,9 +66,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "playerName": "Sean Plott",
        "cheatMode": False
      })})
@@ -112,9 +116,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "score": {
          "$gte": 1000,
          "$lte": 3000
@@ -142,9 +150,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "score": {
          "$in": [
            1,
@@ -185,9 +197,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "playerName": {
          "$nin": [
            "Jonathan Walsh",
@@ -218,9 +234,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "score": {
          "$exists": True
        }
@@ -247,9 +267,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "score": {
          "$exists": False
        }
@@ -276,9 +300,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/_User
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "hometown": {
          "$select": {
            "query": {
@@ -326,9 +354,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"order":"score"})
+params = urllib.parse.urlencode({"order": "score"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -351,9 +383,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"order":"-score"})
+params = urllib.parse.urlencode({"order": "-score"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -376,9 +412,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"order":"score,-name"})
+params = urllib.parse.urlencode({"order": "score, -name"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -402,9 +442,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"limit":200,"skip":400})
+params = urllib.parse.urlencode({"limit": 200, "skip": 400})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -429,9 +473,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"keys":"[score,playerName]"})
+params = urllib.parse.urlencode({"keys": "[score, playerName]"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -454,9 +502,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"excludeKeys":"playerName"})
+params = urllib.parse.urlencode({"excludeKeys": "playerName"})
 connection.connect()
 connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -491,10 +543,14 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({
-    "where":json.dumps({
+params = urllib.parse.urlencode({
+    "where": json.dumps({
       "playerName": {
         "$nin": [
           "Jonathan Walsh",
@@ -532,9 +588,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/RandomObject
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "arrayKey": 2
      })})
 connection.connect()
@@ -559,9 +619,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/RandomObject
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "arrayKey": {
          "$all": [
            2,
@@ -596,9 +660,13 @@ curl -X GET \
 

 # Finds barbecue sauces that start with "Big Daddy"
-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "name": {
          "$regex": "^Big Daddy"
        }
@@ -652,9 +720,13 @@ curl -X GET \
 

 # Finds barbecue sauces that contains "Daddy"
-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('api.parse.com', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "name": {
          "$text": {
           "$search": {
@@ -689,9 +761,13 @@ curl -X GET \
 

 # Finds string that contains "Daddy" ordered by relevance
-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('api.parse.com', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "name": {
          "$text": {
           "$search": {
@@ -729,9 +805,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "post": {
          "__type": "Pointer",
          "className": "Post",
@@ -760,9 +840,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "post": {
          "$inQuery": {
            "where": {
@@ -796,9 +880,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "post": {
          "$notInQuery": {
            "where": {
@@ -832,9 +920,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/users
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "$relatedTo": {
          "object": {
            "__type": "Pointer",
@@ -868,9 +960,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"order":"-createdAt","limit":10,"include":"post"})
+params = urllib.parse.urlencode({"order": "-createdAt", "limit": 10, "include": "post"})
 connection.connect()
 connection.request('GET', '/parse/classes/Comment?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -918,9 +1014,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"order":"-createdAt","limit":10,"include":"post.author"})
+params = urllib.parse.urlencode({"order": "-createdAt", "limit": 10, "include": "post.author"})
 connection.connect()
 connection.request('GET', '/parse/classes/Comment?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -951,9 +1051,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "playerName": "Jonathan Walsh"
      }),"count":1,"limit":0})
 connection.connect()
@@ -991,9 +1095,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Player
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "$or": [
          {
            "wins": {
@@ -1038,9 +1146,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/aggregate/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"distinct":"score"})
+params = urllib.parse.urlencode({"distinct": "score"})
 connection.connect()
 connection.request('GET', '/parse/aggregate/GameScore?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",
@@ -1065,9 +1177,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/aggregate/GameScore
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"where":json.dumps({
+params = urllib.parse.urlencode({"where": json.dumps({
        "playerName": "Sean Plott"
      }),"distinct":"score"})
 connection.connect()
@@ -1108,9 +1224,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"group":json.dumps({
+params = urllib.parse.urlencode({"group": json.dumps({
        "objectId": null,
        "total": {
         "$sum":"$score"
@@ -1140,9 +1260,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"project":json.dumps({
+params = urllib.parse.urlencode({"project": json.dumps({
        "score": 1
      })})
 connection.connect()
@@ -1169,9 +1293,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/aggregate/Player
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"match":json.dumps({
+params = urllib.parse.urlencode({"match": json.dumps({
        "score": {
         "$gt":15
        }
@@ -1207,10 +1335,14 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/classes/Comment
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({
-  "where":json.dumps({
+params = urllib.parse.urlencode({
+  "where": json.dumps({
     "post": {
       "$inQuery": {
         "where": {
diff --git a/_includes/rest/users.md b/_includes/rest/users.md
index 614c77696..467598d04 100644
--- a/_includes/rest/users.md
+++ b/_includes/rest/users.md
@@ -675,9 +675,13 @@ curl -X GET \
   https://YOUR.PARSE-SERVER.HERE/parse/loginAs
 

-import json,http.client,urllib
+import http.client
+import json
+import urllib.parse
+
+
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"userId":"abc123"})
+params = urllib.parse.urlencode({"userId": "abc123"})
 connection.connect()
 connection.request('GET', '/parse/loginAs?%s' % params, '', {
        "X-Parse-Application-Id": "${APPLICATION_ID}",

From b2fb542d885b336aca88b212b8c13d1ddda68ed6 Mon Sep 17 00:00:00 2001
From: Niko Diamadis 
Date: Mon, 8 Aug 2022 13:09:01 +0200
Subject: [PATCH 3/3] Fix REST API python examples' indentation and Json
 formatting

---
 _includes/rest/analytics.md          |  47 ++-
 _includes/rest/cloud-code.md         |  23 +-
 _includes/rest/config.md             |   6 +-
 _includes/rest/files.md              |  44 +--
 _includes/rest/geopoints.md          | 152 ++++----
 _includes/rest/hooks.md              | 206 +++++-----
 _includes/rest/objects.md            | 290 +++++++-------
 _includes/rest/push-notifications.md | 476 +++++++++++------------
 _includes/rest/queries.md            | 562 +++++++++++++--------------
 _includes/rest/roles.md              | 204 +++++-----
 _includes/rest/schemas.md            | 111 ++++--
 _includes/rest/sessions.md           |  61 ++-
 _includes/rest/users.md              | 186 ++++-----
 13 files changed, 1203 insertions(+), 1165 deletions(-)

diff --git a/_includes/rest/analytics.md b/_includes/rest/analytics.md
index 4a023e88f..3d71fb701 100644
--- a/_includes/rest/analytics.md
+++ b/_includes/rest/analytics.md
@@ -40,12 +40,11 @@ import json
 
 connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
 connection.connect()
-connection.request('POST', '/parse/events/AppOpened', json.dumps({
-     }), {
-       "X-Parse-Application-Id": "${APPLICATION_ID}",
-       "X-Parse-REST-API-Key": "${REST_API_KEY}",
-       "Content-Type": "application/json"
-     })
+connection.request('POST', '/parse/events/AppOpened', '', {
+    "X-Parse-Application-Id": "${APPLICATION_ID}",
+    "X-Parse-REST-API-Key": "${REST_API_KEY}",
+    "Content-Type": "application/json"
+})
 result = json.loads(connection.getresponse().read())
 print(result)
 
@@ -83,16 +82,16 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/events/Search', json.dumps({ - "dimensions": { - "priceRange": "1000-1500", - "source": "craigslist", - "dayType": "weekday" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "dimensions": { + "priceRange": "1000-1500", + "source": "craigslist", + "dayType": "weekday" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -121,14 +120,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/events/Error', json.dumps({ - "dimensions": { - "code": "404" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "dimensions": { + "code": "404" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/cloud-code.md b/_includes/rest/cloud-code.md index 9f8ad4118..5c498d8ba 100644 --- a/_includes/rest/cloud-code.md +++ b/_includes/rest/cloud-code.md @@ -21,12 +21,11 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('POST', '/parse/functions/hello', json.dumps({ - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) +connection.request('POST', '/parse/functions/hello', '', { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -57,12 +56,12 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/jobs/userMigration', json.dumps({ - "plan": "paid" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "plan": "paid" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/config.md b/_includes/rest/config.md index 133e73eaa..4f682f219 100644 --- a/_includes/rest/config.md +++ b/_includes/rest/config.md @@ -21,9 +21,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/config', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/files.md b/_includes/rest/files.md index c306e3100..5bfc88eb4 100644 --- a/_includes/rest/files.md +++ b/_includes/rest/files.md @@ -21,10 +21,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/files/hello.txt', 'Hello, World!', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "text/plain" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "text/plain" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -65,10 +65,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/files/pic.jpg', open('myPicture.jpg', 'rb').read(), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "image/jpeg" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "image/jpeg" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -102,17 +102,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/classes/PlayerProfile', json.dumps({ - "name": "Andrew", - "picture": { - "name": "...profile.png", - "url:": "...profile.png", - "__type": "File" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "name": "Andrew", + "picture": { + "name": "...profile.png", + "url:": "...profile.png", + "__type": "File" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -140,9 +140,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/files/...profile.png', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/geopoints.md b/_includes/rest/geopoints.md index afec9c734..ff9ca70f1 100644 --- a/_includes/rest/geopoints.md +++ b/_includes/rest/geopoints.md @@ -29,16 +29,16 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/classes/PlaceObject', json.dumps({ - "location": { - "__type": "GeoPoint", - "latitude": 40.0, - "longitude": -30.0 - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "location": { + "__type": "GeoPoint", + "latitude": 40.0, + "longitude": -30.0 + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -74,19 +74,19 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"limit": 10, "where": json.dumps({ - "location": { - "$nearSphere": { - "__type": "GeoPoint", - "latitude": 30.0, - "longitude": -20.0 - } - } - })}) + "location": { + "$nearSphere": { + "__type": "GeoPoint", + "latitude": 30.0, + "longitude": -20.0 + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/PlaceObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -149,20 +149,20 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "location": { - "$nearSphere": { - "__type": "GeoPoint", - "latitude": 30.0, - "longitude": -20.0 - }, - "$maxDistanceInMiles": 10.0 - } - })}) + "location": { + "$nearSphere": { + "__type": "GeoPoint", + "latitude": 30.0, + "longitude": -20.0 + }, + "$maxDistanceInMiles": 10.0 + } +})}) connection.connect() connection.request('GET', '/parse/classes/PlaceObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -204,28 +204,28 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "location": { - "$within": { - "$box": [ - { - "__type": "GeoPoint", - "latitude": 37.71, - "longitude": -122.53 - }, - { - "__type": "GeoPoint", - "latitude": 30.82, - "longitude": -122.37 - } - ] - } - } - })}) + "location": { + "$within": { + "$box": [ + { + "__type": "GeoPoint", + "latitude": 37.71, + "longitude": -122.53 + }, + { + "__type": "GeoPoint", + "latitude": 30.82, + "longitude": -122.37 + } + ] + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/PizzaPlaceObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -274,33 +274,33 @@ import urllib.parse connection = http.client.HTTPSConnection('api.parse.com', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "location": { - "$geoWithin": { + "location": { + "$geoWithin": { "$polygon": [ - { - "__type": "GeoPoint", - "latitude": 25.774, - "longitude": -80.190 - }, - { - "__type": "GeoPoint", - "latitude": 18.466, - "longitude": -66.118 - }, - { - "__type": "GeoPoint", - "latitude": 32.321, - "longitude": -64.757 - } + { + "__type": "GeoPoint", + "latitude": 25.774, + "longitude": -80.190 + }, + { + "__type": "GeoPoint", + "latitude": 18.466, + "longitude": -66.118 + }, + { + "__type": "GeoPoint", + "latitude": 32.321, + "longitude": -64.757 + } ] - } - } - })}) + } + } +})}) connection.connect() connection.request('GET', '/1/classes/PizzaPlaceObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/hooks.md b/_includes/rest/hooks.md index 0eafe393b..219c71298 100644 --- a/_includes/rest/hooks.md +++ b/_includes/rest/hooks.md @@ -67,10 +67,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/hooks/functions', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -107,10 +107,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/hooks/functions/sendMessage', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -146,10 +146,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/hooks/triggers', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -194,10 +194,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/hooks/triggers/Scores/beforeSave', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -256,13 +256,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('POST', '/parse/hooks/functions', json.dumps( - {"functionName":"baz","url":"https://api.example.com/baz"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('POST', '/parse/hooks/functions', json.dumps({ + "functionName": "baz", + "url": "https://api.example.com/baz" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -296,13 +297,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('POST', '/parse/hooks/functions', json.dumps( - {"functionName":"bar","url":"https://api.example.com/bar"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('POST', '/parse/hooks/functions', json.dumps({ + "functionName": "bar", + "url": "https://api.example.com/bar" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -348,13 +350,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('POST', '/parse/hooks/triggers', json.dumps( - {"className": "Game", "triggerName": "beforeSave", "url": "https://api.example.com/Game/beforeSave"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('POST', '/parse/hooks/triggers', json.dumps({ + "className": "Game", + "triggerName": "beforeSave", + "url": "https://api.example.com/Game/beforeSave" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -392,13 +396,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('POST', '/parse/hooks/triggers', json.dumps( - {"className": "Tournament", "triggerName": "beforeDelete", "url": "https://api.example.com/Scores/beforeDelete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('POST', '/parse/hooks/triggers', json.dumps({ + "className": "Tournament", + "triggerName": "beforeDelete", + "url": "https://api.example.com/Scores/beforeDelete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -436,13 +442,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/functions/baz', json.dumps( - {"url":"https://api.example.com/_baz"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/functions/baz', json.dumps({ + "url":"https://api.example.com/_baz" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -476,13 +482,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/functions/bar', json.dumps( - {"url":"https://api.example.com/_bar"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/functions/bar', json.dumps({ + "url": "https://api.example.com/_bar" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -517,13 +523,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps( - {"url": "https://api.example.com/Game/_beforeSave"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps({ + "url": "https://api.example.com/Game/_beforeSave" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -561,13 +567,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps( - {"url": "https://api.example.com/Scores/beforeDelete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps({ + "url": "https://api.example.com/Scores/beforeDelete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -603,13 +609,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/functions/foo', json.dumps( - {"__op": "Delete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/functions/foo', json.dumps({ + "__op": "Delete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -640,13 +646,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/functions/sendMessage', json.dumps( - {"__op": "Delete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/functions/sendMessage', json.dumps({ + "__op": "Delete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -677,13 +683,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps( - {"__op": "Delete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/triggers/Game/beforeSave', json.dumps({ + "__op": "Delete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -714,13 +720,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps( - {"__op": "Delete"} - ), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/hooks/triggers/Tournament/beforeDelete', json.dumps({ + "__op": "Delete" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md index 4c01d134c..3239da66a 100644 --- a/_includes/rest/objects.md +++ b/_includes/rest/objects.md @@ -73,14 +73,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/classes/GameScore', json.dumps({ - "score": 1337, - "playerName": "Sean Plott", - "cheatMode": False - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "score": 1337, + "playerName": "Sean Plott", + "cheatMode": False +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) results = json.loads(connection.getresponse().read()) print results @@ -121,9 +121,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -167,9 +167,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"include": "game"}) connection.connect() connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -198,9 +198,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"include": "game", "readPreference": "SECONDARY", "includeReadPreference": "SECONDARY_PREFERRED"}) connection.connect() connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -229,12 +229,12 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "score": 73453 - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "score": 73453 +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -269,15 +269,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "score": { - "__op": "Increment", - "amount": 1 - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "score": { + "__op": "Increment", + "amount": 1 + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -302,15 +302,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "score": { - "__op": "Increment", - "amount": -1 - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "score": { + "__op": "Increment", + "amount": -1 + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -343,18 +343,18 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "skills": { - "__op": "AddUnique", - "objects": [ - "flying", - "kungfu" - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "skills": { + "__op": "AddUnique", + "objects": [ + "flying", + "kungfu" + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -381,21 +381,21 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "opponents": { - "__op": "AddRelation", - "objects": [ - { - "__type": "Pointer", - "className": "Player", - "objectId": "Vx4nudeWn" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "opponents": { + "__op": "AddRelation", + "objects": [ + { + "__type": "Pointer", + "className": "Player", + "objectId": "Vx4nudeWn" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -420,21 +420,21 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "opponents": { - "__op": "RemoveRelation", - "objects": [ - { - "__type": "Pointer", - "className": "Player", - "objectId": "Vx4nudeWn" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "opponents": { + "__op": "RemoveRelation", + "objects": [ + { + "__type": "Pointer", + "className": "Player", + "objectId": "Vx4nudeWn" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -459,9 +459,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/classes/GameScore/Ed1nuqPvcm', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -486,14 +486,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/classes/GameScore/Ed1nuqPvcm', json.dumps({ - "opponents": { - "__op": "Delete" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "opponents": { + "__op": "Delete" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -541,29 +541,29 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/batch', json.dumps({ - "requests": [ - { - "method": "POST", - "path": "/parse/classes/GameScore", - "body": { - "score": 1337, - "playerName": "Sean Plott" - } - }, - { - "method": "POST", - "path": "/parse/classes/GameScore", - "body": { - "score": 1338, - "playerName": "ZeroCool" - } - } - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "requests": [ + { + "method": "POST", + "path": "/parse/classes/GameScore", + "body": { + "score": 1337, + "playerName": "Sean Plott" + } + }, + { + "method": "POST", + "path": "/parse/classes/GameScore", + "body": { + "score": 1338, + "playerName": "ZeroCool" + } + } + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -624,24 +624,24 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/batch', json.dumps({ - "requests": [ - { - "method": "PUT", - "path": "/parse/classes/GameScore/Ed1nuqPvcm", - "body": { - "score": 999999 - } - }, - { - "method": "DELETE", - "path": "/parse/classes/GameScore/Cpl9lrueY5" - } - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "requests": [ + { + "method": "PUT", + "path": "/parse/classes/GameScore/Ed1nuqPvcm", + "body": { + "score": 999999 + } + }, + { + "method": "DELETE", + "path": "/parse/classes/GameScore/Cpl9lrueY5" + } + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -692,18 +692,18 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "createdAt": { - "$gte": { - "__type": "Date", - "iso": "2022-01-01T12:23:45.678Z" - } - } - })}) + "createdAt": { + "$gte": { + "__type": "Date", + "iso": "2022-01-01T12:23:45.678Z" + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/push-notifications.md b/_includes/rest/push-notifications.md index b8a3db354..88114096c 100644 --- a/_includes/rest/push-notifications.md +++ b/_includes/rest/push-notifications.md @@ -50,16 +50,16 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/installations', json.dumps({ - "deviceType": "ios", - "deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "channels": [ - "" - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "deviceType": "ios", + "deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "channels": [ + "" + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -113,17 +113,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/installations', json.dumps({ - "deviceType": "android", - "pushType": "gcm", - "deviceToken": "APA91bFMvbrGg4cp3KUV_7dhU1gmwE_...", - "channels": [ - "" - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "deviceType": "android", + "pushType": "gcm", + "deviceToken": "APA91bFMvbrGg4cp3KUV_7dhU1gmwE_...", + "channels": [ + "" + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -148,9 +148,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/installations/mrmBZvsErB', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -199,17 +199,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({ - "deviceType": "ios", - "deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", - "channels": [ - "", - "foo" - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "deviceType": "ios", + "deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "channels": [ + "", + "foo" + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -238,9 +238,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/installations', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -297,9 +297,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/installations/mrmBZvsErB', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -342,14 +342,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({ - "channels": [ - "Giants" - ] - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "channels": [ + "Giants" + ] +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -390,18 +390,18 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "channels": [ - "Giants", - "Mets" - ], - "data": { - "alert": "The Giants won against the Mets 2-3." - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "channels": [ + "Giants", + "Mets" + ], + "data": { + "alert": "The Giants won against the Mets 2-3." + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -438,14 +438,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({ - "scores": True, - "gameResults": True, - "injuryReports": True - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "scores": True, + "gameResults": True, + "injuryReports": True +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -476,16 +476,16 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/installations/mrmBZvsErB', json.dumps({ - "user": { - "__type": "Pointer", - "className": "_User", - "objectId": "vmRZXZ1Dvo" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "user": { + "__type": "Pointer", + "className": "_User", + "objectId": "vmRZXZ1Dvo" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -519,17 +519,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "injuryReports": True - }, - "data": { - "alert": "Willie Hayes injured by own pop fly." - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "injuryReports": True + }, + "data": { + "alert": "Willie Hayes injured by own pop fly." + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -562,18 +562,18 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "channels": "Giants", - "scores": True - }, - "data": { - "alert": "The Giants scored a run! The score is now 2-2." - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "channels": "Giants", + "scores": True + }, + "data": { + "alert": "The Giants scored a run! The score is now 2-2." + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -616,31 +616,31 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "user": { - "$inQuery":{ - "where":{ - "location":{ - "$nearSphere":{ - "__type":"GeoPoint", - "latitude":51.252437591552734, - "longitude":-1.6038470268249512 - }, - "$maxDistanceInMiles":1.0 - } - }, - "className":"_User" + "where": { + "user": { + "$inQuery": { + "where": { + "location": { + "$nearSphere": { + "__type": "GeoPoint", + "latitude": 51.252437591552734, + "longitude": -1.6038470268249512 + }, + "$maxDistanceInMiles": 1.0 + } + }, + "className": "_User" } - } - }, - "data": { - "alert": "Free hotdogs at the Parse concession stand!" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + } + }, + "data": { + "alert": "Free hotdogs at the Parse concession stand!" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -695,20 +695,20 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "channels": [ - "Mets" - ], - "data": { - "alert": "The Mets scored! The game is now tied 1-1.", - "badge": "Increment", - "sound": "cheering.caf", - "title": "Mets Score!" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "channels": [ + "Mets" + ], + "data": { + "alert": "The Mets scored! The game is now tied 1-1.", + "badge": "Increment", + "sound": "cheering.caf", + "title": "Mets Score!" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -727,20 +727,20 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "channels": [ - "Indians" - ], - "data": { - "action": "com.example.UPDATE_STATUS", - "alert": "Ricky Vaughn was injured during the game last night!", - "name": "Vaughn", - "newsItem": "Man bites dog" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "channels": [ + "Indians" + ], + "data": { + "action": "com.example.UPDATE_STATUS", + "alert": "Ricky Vaughn was injured during the game last night!", + "name": "Vaughn", + "newsItem": "Man bites dog" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -774,15 +774,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "expiration_time": "2015-03-19T22:05:08Z", - "data": { - "alert": "Season tickets on sale until March 19, 2015" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "expiration_time": "2015-03-19T22:05:08Z", + "data": { + "alert": "Season tickets on sale until March 19, 2015" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -813,16 +813,16 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "push_time": "2015-03-13T22:05:08Z", - "expiration_interval": 518400, - "data": { - "alert": "Season tickets on sale until March 19, 2015" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "push_time": "2015-03-13T22:05:08Z", + "expiration_interval": 518400, + "data": { + "alert": "Season tickets on sale until March 19, 2015" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -858,17 +858,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "deviceType": "android" - }, - "data": { - "alert": "Your suitcase has been filled with tiny robots!" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "deviceType": "android" + }, + "data": { + "alert": "Your suitcase has been filled with tiny robots!" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -898,17 +898,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "deviceType": "ios" - }, - "data": { - "alert": "Your suitcase has been filled with tiny apples!" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "deviceType": "ios" + }, + "data": { + "alert": "Your suitcase has been filled with tiny apples!" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -938,17 +938,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "deviceType": "winrt" - }, - "data": { - "alert": "Your suitcase has been filled with tiny glass!" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "deviceType": "winrt" + }, + "data": { + "alert": "Your suitcase has been filled with tiny glass!" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -978,17 +978,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "deviceType": "winphone" - }, - "data": { - "alert": "Your suitcase is very hip; very metro." - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "deviceType": "winphone" + }, + "data": { + "alert": "Your suitcase is very hip; very metro." + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1023,18 +1023,18 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/push', json.dumps({ - "where": { - "user_id": "user_123" - }, - "push_time": "2015-03-19T12:00:00Z", - "data": { - "alert": "You previously created a reminder for the game today" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "where": { + "user_id": "user_123" + }, + "push_time": "2015-03-19T12:00:00Z", + "data": { + "alert": "You previously created a reminder for the game today" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1080,15 +1080,15 @@ import json connection = http.client.HTTPSConnection('api.parse.com', 443) connection.connect() connection.request('POST', '/1/push', json.dumps({ - "data": { - "alert": "The default alert for all languages", - "alert-fr": "Une alerte en français" - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "data": { + "alert": "The default alert for all languages", + "alert-fr": "Une alerte en français" + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/queries.md b/_includes/rest/queries.md index 96d4bc8c3..0db42acb2 100644 --- a/_includes/rest/queries.md +++ b/_includes/rest/queries.md @@ -19,9 +19,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/classes/GameScore', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -73,14 +73,14 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "playerName": "Sean Plott", - "cheatMode": False - })}) + "playerName": "Sean Plott", + "cheatMode": False +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -123,16 +123,16 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "score": { - "$gte": 1000, - "$lte": 3000 - } - })}) + "score": { + "$gte": 1000, + "$lte": 3000 + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -157,21 +157,21 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "score": { - "$in": [ - 1, - 3, - 5, - 7, - 9 - ] - } - })}) + "score": { + "$in": [ + 1, + 3, + 5, + 7, + 9 + ] + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -204,19 +204,19 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "playerName": { - "$nin": [ - "Jonathan Walsh", - "Dario Wunsch", - "Shawn Simon" - ] - } - })}) + "playerName": { + "$nin": [ + "Jonathan Walsh", + "Dario Wunsch", + "Shawn Simon" + ] + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -241,15 +241,15 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "score": { - "$exists": True - } - })}) + "score": { + "$exists": True + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -274,15 +274,15 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "score": { - "$exists": False - } - })}) + "score": { + "$exists": False + } +})}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -307,25 +307,25 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "hometown": { - "$select": { - "query": { - "className": "Team", - "where": { - "winPct": { - "$gt": 0.5 - } - } - }, - "key": "city" - } - } - })}) + "hometown": { + "$select": { + "query": { + "className": "Team", + "where": { + "winPct": { + "$gt": 0.5 + } + } + }, + "key": "city" + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/_User?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -363,9 +363,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"order": "score"}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -392,9 +392,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"order": "-score"}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -421,9 +421,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"order": "score, -name"}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -451,9 +451,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"limit": 200, "skip": 400}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -482,9 +482,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"keys": "[score, playerName]"}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -511,9 +511,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"excludeKeys": "playerName"}) connection.connect() connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -549,25 +549,24 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) -params = urllib.parse.urlencode({ - "where": json.dumps({ - "playerName": { +params = urllib.parse.urlencode({"where": json.dumps({ + "playerName": { "$nin": [ - "Jonathan Walsh", - "Dario Wunsch", - "Shawn Simon" + "Jonathan Walsh", + "Dario Wunsch", + "Shawn Simon" ] - } - }), - "order":"score,-name", - "limit":200, - "skip":400, - "keys":"score,playerName"}) + } +}), +"order": "score,-name", +"limit": 200, +"skip": 400, +"keys": "score,playerName"}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -595,13 +594,13 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "arrayKey": 2 - })}) + "arrayKey": 2 +})}) connection.connect() connection.request('GET', '/parse/classes/RandomObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -626,19 +625,19 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "arrayKey": { - "$all": [ - 2, - 3, - 4 - ] - } - })}) + "arrayKey": { + "$all": [ + 2, + 3, + 4 + ] + } +})}) connection.connect() connection.request('GET', '/parse/classes/RandomObject?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -667,15 +666,15 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "name": { - "$regex": "^Big Daddy" - } - })}) + "name": { + "$regex": "^Big Daddy" + } +})}) connection.connect() connection.request('GET', '/parse/classes/BarbecueSauce?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -727,19 +726,19 @@ import urllib.parse connection = http.client.HTTPSConnection('api.parse.com', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "name": { - "$text": { - "$search": { - "$term": "Daddy" - } - } - } - })}) + "name": { + "$text": { + "$search": { + "$term": "Daddy" + } + } + } +})}) connection.connect() connection.request('GET', '/1/classes/BarbecueSauce?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -768,22 +767,21 @@ import urllib.parse connection = http.client.HTTPSConnection('api.parse.com', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "name": { - "$text": { - "$search": { - "$term": "Daddy" - } - } - } - }), - "order":"$score", - "keys":"$score", - }) + "name": { + "$text": { + "$search": { + "$term": "Daddy" + } + } + } +}), +"order": "$score", +"keys": "$score"}) connection.connect() connection.request('GET', '/1/classes/BarbecueSauce?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -812,17 +810,17 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "post": { - "__type": "Pointer", - "className": "Post", - "objectId": "8TOXdXf3tz" - } - })}) + "post": { + "__type": "Pointer", + "className": "Post", + "objectId": "8TOXdXf3tz" + } +})}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -847,22 +845,22 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "post": { - "$inQuery": { - "where": { - "image": { - "$exists": True - } - }, - "className": "Post" - } - } - })}) + "post": { + "$inQuery": { + "where": { + "image": { + "$exists": True + } + }, + "className": "Post" + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -887,22 +885,22 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "post": { - "$notInQuery": { - "where": { - "image": { - "$exists": True - } - }, - "className": "Post" - } - } - })}) + "post": { + "$notInQuery": { + "where": { + "image": { + "$exists": True + } + }, + "className": "Post" + } + } +})}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -927,20 +925,20 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "$relatedTo": { - "object": { - "__type": "Pointer", - "className": "Post", - "objectId": "8TOXdXf3tz" - }, - "key": "likes" - } - })}) + "$relatedTo": { + "object": { + "__type": "Pointer", + "className": "Post", + "objectId": "8TOXdXf3tz" + }, + "key": "likes" + } +})}) connection.connect() connection.request('GET', '/parse/users?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -969,9 +967,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"order": "-createdAt", "limit": 10, "include": "post"}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1023,9 +1021,9 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"order": "-createdAt", "limit": 10, "include": "post.author"}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1058,13 +1056,15 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "playerName": "Jonathan Walsh" - }),"count":1,"limit":0}) + "playerName": "Jonathan Walsh" +}), +"count": 1, +"limit": 0}) connection.connect() connection.request('GET', '/parse/classes/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1102,24 +1102,24 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "$or": [ - { - "wins": { - "$gt": 150 - } - }, - { - "wins": { - "$lt": 5 - } - } - ] - })}) + "$or": [ + { + "wins": { + "$gt": 150 + } + }, + { + "wins": { + "$lt": 5 + } + } + ] +})}) connection.connect() connection.request('GET', '/parse/classes/Player?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1155,10 +1155,10 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"distinct": "score"}) connection.connect() connection.request('GET', '/parse/aggregate/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1184,14 +1184,15 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"where": json.dumps({ - "playerName": "Sean Plott" - }),"distinct":"score"}) + "playerName": "Sean Plott" +}), +"distinct": "score"}) connection.connect() connection.request('GET', '/parse/aggregate/GameScore?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1231,17 +1232,18 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"group": json.dumps({ - "objectId": null, - "total": { - "$sum":"$score" - } - }),"distinct":"score"}) + "objectId": null, + "total": { + "$sum": "$score" + } +}), +"distinct": "score"}) connection.connect() connection.request('GET', '/parse/aggregate/Player?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1267,14 +1269,14 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"project": json.dumps({ - "score": 1 - })}) + "score": 1 +})}) connection.connect() connection.request('GET', '/parse/aggregate/Player?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1300,16 +1302,16 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) params = urllib.parse.urlencode({"match": json.dumps({ - "score": { - "$gt":15 - } - })}) + "score": { + "$gt": 15 + } +})}) connection.connect() connection.request('GET', '/parse/aggregate/Player?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -1341,29 +1343,27 @@ import urllib.parse connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) -params = urllib.parse.urlencode({ - "where": json.dumps({ +params = urllib.parse.urlencode({"where": json.dumps({ "post": { - "$inQuery": { - "where": { - "image": { - "$exists": True - } - }, - "className": "Post" - } + "$inQuery": { + "where": { + "image": { + "$exists": True + } + }, + "className": "Post" + } } - }), - "include":"post", - "readPreference":"SECONDARY", - "includeReadPreference":"SECONDARY_PREFERRED", - "subqueryReadPreference":"NEAREST" -}) +}), +"include": "post", +"readPreference": "SECONDARY", +"includeReadPreference": "SECONDARY_PREFERRED", +"subqueryReadPreference": "NEAREST"}) connection.connect() connection.request('GET', '/parse/classes/Comment?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/roles.md b/_includes/rest/roles.md index b65a219dc..b3984c9b8 100644 --- a/_includes/rest/roles.md +++ b/_includes/rest/roles.md @@ -42,17 +42,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/roles', json.dumps({ - "name": "Moderators", - "ACL": { - "*": { - "read": True - } - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "name": "Moderators", + "ACL": { + "*": { + "read": True + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -104,37 +104,37 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/roles', json.dumps({ - "name": "Moderators", - "ACL": { - "*": { - "read": True - } - }, - "roles": { - "__op": "AddRelation", - "objects": [ - { - "__type": "Pointer", - "className": "_Role", - "objectId": "Ed1nuqPvc" - } - ] - }, - "users": { - "__op": "AddRelation", - "objects": [ - { - "__type": "Pointer", - "className": "_User", - "objectId": "8TOXdXf3tz" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "name": "Moderators", + "ACL": { + "*": { + "read": True + } + }, + "roles": { + "__op": "AddRelation", + "objects": [ + { + "__type": "Pointer", + "className": "_Role", + "objectId": "Ed1nuqPvc" + } + ] + }, + "users": { + "__op": "AddRelation", + "objects": [ + { + "__type": "Pointer", + "className": "_User", + "objectId": "8TOXdXf3tz" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -175,9 +175,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/roles/mrmBZvsErB', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -244,26 +244,26 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/roles/mrmBZvsErB', json.dumps({ - "users": { - "__op": "AddRelation", - "objects": [ - { - "__type": "Pointer", - "className": "_User", - "objectId": "8TOXdXf3tz" - }, - { - "__type": "Pointer", - "className": "_User", - "objectId": "g7y9tkhB7O" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "users": { + "__op": "AddRelation", + "objects": [ + { + "__type": "Pointer", + "className": "_User", + "objectId": "8TOXdXf3tz" + }, + { + "__type": "Pointer", + "className": "_User", + "objectId": "g7y9tkhB7O" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -299,21 +299,21 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/roles/mrmBZvsErB', json.dumps({ - "roles": { - "__op": "RemoveRelation", - "objects": [ - { - "__type": "Pointer", - "className": "_Role", - "objectId": "Ed1nuqPvc" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "roles": { + "__op": "RemoveRelation", + "objects": [ + { + "__type": "Pointer", + "className": "_Role", + "objectId": "Ed1nuqPvc" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -341,9 +341,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/roles/mrmBZvsErB', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -367,10 +367,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/roles/mrmBZvsErB', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -434,21 +434,21 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/roles/<ModeratorsRoleObjectId>', json.dumps({ - "roles": { - "__op": "AddRelation", - "objects": [ - { - "__type": "Pointer", - "className": "_Role", - "objectId": "<AdministratorsRoleObjectId>" - } - ] - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "roles": { + "__op": "AddRelation", + "objects": [ + { + "__type": "Pointer", + "className": "_Role", + "objectId": "<AdministratorsRoleObjectId>" + } + ] + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/schemas.md b/_includes/rest/schemas.md index 5296ac7fc..13ca270ae 100644 --- a/_includes/rest/schemas.md +++ b/_includes/rest/schemas.md @@ -33,10 +33,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/schemas', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -93,10 +93,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/schemas/Game', "", { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -132,12 +132,17 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/schemas/City', json.dumps({ - "className":"City","fields":{"name":{"type":"String"} } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "className": "City", + "fields": { + "name": { + "type": "String" + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -175,12 +180,22 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/schemas/City', json.dumps({ - "className":"City","fields":{"name":{"type":"String"},"indexes":{"indexName":{"name":1} } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "className": "City", + "fields": { + "name": { + "type": "String" + }, + "indexes": { + "indexName": { + "name": 1 + } + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -219,13 +234,23 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/schemas/City', json.dumps( - "className":"City","fields":{"population":{"type":"Number"},"indexes":{"population_index":{"population":1} } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/schemas/City', json.dumps({ + "className": "City", + "fields": { + "population": { + "type": "Number" + }, + "indexes": { + "population_index": { + "population": 1 + } + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -262,13 +287,23 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/schemas/City', json.dumps( - "className":"City","fields":{"population":{"__op" : "Delete"},"indexes":{"population_index":{"__op" : "Delete"} } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/schemas/City', json.dumps({ + "className": "City", + "fields": { + "population": { + "__op": "Delete" + }, + "indexes": { + "population_index": { + "__op" : "Delete" + } + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -295,10 +330,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/schemas/City', "", { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "Content-Type": "application/json" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/sessions.md b/_includes/rest/sessions.md index 0ca7c5036..0535e2bde 100644 --- a/_includes/rest/sessions.md +++ b/_includes/rest/sessions.md @@ -52,10 +52,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/sessions/Axy98kq1B09', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -79,10 +79,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/sessions/me', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -110,10 +110,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/logout', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -139,10 +139,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/sessions', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -168,10 +168,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/logout', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -195,10 +195,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/sessions/Axy98kq1B09', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -235,13 +235,12 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() -connection.request('PUT', '/parse/sessions/me', json.dumps({ - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:aVrtljyb7E8xKo9256gfvp4n2", - "Content-Type": "application/json" - }) +connection.request('PUT', '/parse/sessions/me', '', { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:aVrtljyb7E8xKo9256gfvp4n2", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) diff --git a/_includes/rest/users.md b/_includes/rest/users.md index 467598d04..1a0b77fb0 100644 --- a/_includes/rest/users.md +++ b/_includes/rest/users.md @@ -30,15 +30,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/users', json.dumps({ - "username": "cooldude6", - "password": "p_n7!-e8", - "phone": "415-392-0202" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Revocable-Session": "1", - "Content-Type": "application/json" - }) + "username": "cooldude6", + "password": "p_n7!-e8", + "phone": "415-392-0202" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Revocable-Session": "1", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -84,14 +84,14 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/login', json.dumps({ - "username": "cooldude6", - "password": "p_n7!-e8" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Revocable-Session": "1", - "Content-Type": "application/json" - }) + "username": "cooldude6", + "password": "p_n7!-e8" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Revocable-Session": "1", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -139,12 +139,12 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/verificationEmailRequest', json.dumps({ - "email": "email@example.com" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "email": "email@example.com" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -173,12 +173,12 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/requestPasswordReset', json.dumps({ - "email": "coolguy@iloveapps.com" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "Content-Type": "application/json" - }) + "email": "coolguy@iloveapps.com" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -205,9 +205,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/users/g7y9tkhB7O', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -245,10 +245,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/users/me', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -289,13 +289,13 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/users/g7y9tkhB7O', json.dumps({ - "phone": "415-369-6201" - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im", - "Content-Type": "application/json" - }) + "phone": "415-369-6201" +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -328,9 +328,9 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('GET', '/parse/users', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -381,10 +381,10 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('DELETE', '/parse/users/g7y9tkhB7O', '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:pnktnjyb996sj4p156gjtp4im" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -470,22 +470,22 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('POST', '/parse/users', json.dumps({ - "authData": { - "twitter": { - "id": "12345678", - "screen_name": "ParseIt", - "consumer_key": "SaMpLeId3X7eLjjLgWEw", - "consumer_secret": "SaMpLew55QbMR0vTdtOACfPXa5UdO2THX1JrxZ9s3c", - "auth_token": "12345678-SaMpLeTuo3m2avZxh5cjJmIrAfx4ZYyamdofM7IjU", - "auth_token_secret": "SaMpLeEb13SpRzQ4DAIzutEkCE2LBIm2ZQDsP3WUU" - } - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Revocable-Session": "1", - "Content-Type": "application/json" - }) + "authData": { + "twitter": { + "id": "12345678", + "screen_name": "ParseIt", + "consumer_key": "SaMpLeId3X7eLjjLgWEw", + "consumer_secret": "SaMpLew55QbMR0vTdtOACfPXa5UdO2THX1JrxZ9s3c", + "auth_token": "12345678-SaMpLeTuo3m2avZxh5cjJmIrAfx4ZYyamdofM7IjU", + "auth_token_secret": "SaMpLeEb13SpRzQ4DAIzutEkCE2LBIm2ZQDsP3WUU" + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Revocable-Session": "1", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -568,19 +568,19 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/users/uMz0YZeAqc', json.dumps({ - "authData": { - "facebook": { - "id": "123456789", - "access_token": "SaMpLeAAibS7Q55FSzcERWIEmzn6rosftAr7pmDME10008bWgyZAmv7mziwfacNOhWkgxDaBf8a2a2FCc9Hbk9wAsqLYZBLR995wxBvSGNoTrEaL", - "expiration_date": "2022-01-01T12:23:45.678Z" - } - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:samplei3l83eerhnln0ecxgy5", - "Content-Type": "application/json" - }) + "authData": { + "facebook": { + "id": "123456789", + "access_token": "SaMpLeAAibS7Q55FSzcERWIEmzn6rosftAr7pmDME10008bWgyZAmv7mziwfacNOhWkgxDaBf8a2a2FCc9Hbk9wAsqLYZBLR995wxBvSGNoTrEaL", + "expiration_date": "2022-01-01T12:23:45.678Z" + } + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:samplei3l83eerhnln0ecxgy5", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -614,15 +614,15 @@ import json connection = http.client.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443) connection.connect() connection.request('PUT', '/parse/users/uMz0YZeAqc', json.dumps({ - "authData": { - "facebook": null - } - }), { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Session-Token": "r:samplei3l83eerhnln0ecxgy5", - "Content-Type": "application/json" - }) + "authData": { + "facebook": null + } +}), { + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Session-Token": "r:samplei3l83eerhnln0ecxgy5", + "Content-Type": "application/json" +}) result = json.loads(connection.getresponse().read()) print(result) @@ -684,11 +684,11 @@ connection = http.client.HTTPSConnection(' params = urllib.parse.urlencode({"userId": "abc123"}) connection.connect() connection.request('GET', '/parse/loginAs?%s' % params, '', { - "X-Parse-Application-Id": "${APPLICATION_ID}", - "X-Parse-REST-API-Key": "${REST_API_KEY}", - "X-Parse-Master-Key": "${MASTER_KEY}", - "X-Parse-Revocable-Session": "1" - }) + "X-Parse-Application-Id": "${APPLICATION_ID}", + "X-Parse-REST-API-Key": "${REST_API_KEY}", + "X-Parse-Master-Key": "${MASTER_KEY}", + "X-Parse-Revocable-Session": "1" +}) result = json.loads(connection.getresponse().read()) print(result)