diff --git a/_includes/common/data.md b/_includes/common/data.md index 413b28cd..2b405e3f 100644 --- a/_includes/common/data.md +++ b/_includes/common/data.md @@ -36,7 +36,7 @@ You may import data into your Parse app by using CSV or JSON files. To create a The JSON format is an array of objects in our REST format or a JSON object with a `results` that contains an array of objects. It must adhere to the [JSON standard](http://json.org/). A file containing regular objects could look like: -```js +```json { "results": [ { "score": 1337, @@ -63,7 +63,7 @@ In addition to the exposed fields, objects in the Parse User class can also have A file containing a `User` object could look like: -```js +```json { "results": [{ "username": "cooldude", diff --git a/_includes/graphql/classes.md b/_includes/graphql/classes.md index 83035d6b..a0ebf536 100644 --- a/_includes/graphql/classes.md +++ b/_includes/graphql/classes.md @@ -1,7 +1,7 @@ # Classes Since your application does not have a schema yet, you can use the `createClass` mutation to create your first class through the GraphQL API. Run the following: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -34,7 +34,7 @@ mutation createGameScoreClass { } } ``` -```js +```json // Response { "data": { diff --git a/_includes/graphql/customisation.md b/_includes/graphql/customisation.md index 94431431..81a68f14 100644 --- a/_includes/graphql/customisation.md +++ b/_includes/graphql/customisation.md @@ -326,7 +326,7 @@ extend type Query { Parse.Cloud.define("hello", () => "Hello, world!"); ``` -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -342,7 +342,7 @@ query hello { The code above should resolve to this: -```js +```json // Response { "data": { @@ -418,7 +418,7 @@ Parse.Cloud.define("addToCart", async (req) => { }); ``` -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -437,7 +437,7 @@ mutation addItemToCart { The code above should resolve to something similar to this: -```js +```json // Response { "data": { diff --git a/_includes/graphql/files.md b/_includes/graphql/files.md index 4c251f1d..6cc827ec 100644 --- a/_includes/graphql/files.md +++ b/_includes/graphql/files.md @@ -5,7 +5,7 @@ The GraphQL API supports file upload via [GraphQL Upload](https://github.com/jay ## Add a File field to a Class First of all we will update our `GameScore` class with a `screenshot` field of type `File`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -29,7 +29,7 @@ mutation updateGameScoreClass { } } ``` -```js +```json // Response { "data": { @@ -46,7 +46,7 @@ mutation updateGameScoreClass { The GraphQL API supports nested mutation for the `File` type, so you can send the file along with the Parse Object or just upload the file and get the returned information. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -65,7 +65,7 @@ mutation createFile($file: Upload!) { } } ``` -```js +```json // Response { "data": { @@ -83,7 +83,7 @@ mutation createFile($file: Upload!) { You can add an existing file to an object. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -116,7 +116,7 @@ mutation createGameScore { } } ``` -```js +```json // Response { "data": { @@ -134,7 +134,7 @@ mutation createGameScore { ## Create and add a file Lets create a new `GameScore` object and upload the file. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -164,7 +164,7 @@ mutation createGameScore($file: Upload! ) { } } ``` -```js +```json // Response { "data": { diff --git a/_includes/graphql/health-check.md b/_includes/graphql/health-check.md index ff56c225..2b905a0e 100644 --- a/_includes/graphql/health-check.md +++ b/_includes/graphql/health-check.md @@ -2,7 +2,7 @@ Now that you have set up your GraphQL environment, it is time to run your first query. Execute the following code in your GraphQL Playground to check your API's health: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -16,7 +16,7 @@ query healthy { health } ``` -```js +```json // Response { "data": { diff --git a/_includes/graphql/objects.md b/_includes/graphql/objects.md index 8881ad98..2ea15307 100644 --- a/_includes/graphql/objects.md +++ b/_includes/graphql/objects.md @@ -6,7 +6,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `createGameScore`, and you should be able to run the code below in your GraphQL Playground: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -45,7 +45,7 @@ mutation createAGameScore { } } ``` -```js +```json // Response { "data": { @@ -78,7 +78,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `updateGameScore`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -101,7 +101,7 @@ mutation updateAGameScore { } } ``` -```js +```json // Response { "data": { @@ -122,7 +122,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new mutation called `deleteGameScore`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -143,7 +143,7 @@ mutation deleteAGameScore { The code above should resolve to something similar to this: -```js +```json // Response { "data": { @@ -163,7 +163,7 @@ The code above should resolve to something similar to this: The GraphQL API supports nested mutations, so you can create objects with complex relationships in one request. Assuming that we have classes `Country`, `City` and `Company`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -208,7 +208,7 @@ mutation aNestedMutation { } } ``` -```js +```json // Response { "data": { diff --git a/_includes/graphql/queries.md b/_includes/graphql/queries.md index 915023d7..de3673d3 100644 --- a/_includes/graphql/queries.md +++ b/_includes/graphql/queries.md @@ -6,7 +6,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new query called `gameScore`, and you should be able to run the code below in your GraphQL Playground: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -31,7 +31,7 @@ query getAGameScore { } } ``` -```js +```json // Response { "data": { @@ -55,7 +55,7 @@ query getAGameScore { With the Relay specification you also have the choice to use [GraphQL Fragments](https://graphql.org/learn/queries/#fragments) through the `node` GraphQL Query. For a `GameScore` object the following query will do the job. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -77,7 +77,7 @@ query getGameScoreWithNodeRelay { } ``` -```js +```json // Response { "data": { @@ -94,7 +94,7 @@ query getGameScoreWithNodeRelay { Here using `Node Relay` is useful for writing generic requests for your front end components. For example, assuming we already have a `User` with a `Relay Node Id: X1VzZXI6Q1lMeWJYMjFjcw==` and `username: "johndoe"`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -119,7 +119,7 @@ query genericGet { } } ``` -```js +```json // Response { "data": { @@ -138,7 +138,7 @@ For each class in your application's schema, Parse Server automatically generate For example, if you have a class named `GameScore` in the schema, Parse Server automatically generates a new query called `gameScores`, and you should be able to run the code below in your GraphQL Playground: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -168,7 +168,7 @@ query getSomeGameScores{ } } ``` -```js +```json // Response { "data": { @@ -218,7 +218,7 @@ query getSomeGameScores{ You can use the `where` argument to add constraints to a class find query. See the example below: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -244,7 +244,7 @@ query getSomeGameScores { } } ``` -```js +```json // Response { "data": { @@ -271,7 +271,7 @@ Visit your GraphQL Playground if you want to know all the available constraints. You can use the `order` argument to select in which order the results are returned in a class find query. See the example below: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -300,7 +300,7 @@ query getSomeGameScores { } } ``` -```js +```json // Response { "data": { @@ -346,7 +346,7 @@ You can combine multiple parameters like: `before & last` or `after & first`, as Note: `cursor` is different to `id`, it is a temporary pagination ID for the query. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -376,7 +376,7 @@ query getSomeGameScores { } } ``` -```js +```json // Response { "data": { @@ -410,7 +410,7 @@ query getSomeGameScores { The GraphQL API supports nested queries, so you can find object and then execute query on relational child fields. Assuming that we have classes `Country`, `City`, `Company`: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -440,7 +440,7 @@ query aNestedQuery { } } ``` -```js +```json // Response { "data": { @@ -479,7 +479,7 @@ Let's build a query matching countries that contain at least one city with more The GraphQL API can handle this type of complex relational query with ease. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -524,7 +524,7 @@ The GraphQL API can handle this type of complex relational query with ease. ... too many brackets here } ``` -```js +```json // Response { "data": { @@ -562,7 +562,7 @@ Assuming that we have a `Country` class, `City` class, `Street` class, `House` c Let's build a query matching houses where the street has a city that has a country with a name equal to `France`. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -607,7 +607,7 @@ Let's build a query matching houses where the street has a city that has a count } ``` -```js +```json // Response { "data": { diff --git a/_includes/graphql/users.md b/_includes/graphql/users.md index 5a3c9adf..cf3252a4 100644 --- a/_includes/graphql/users.md +++ b/_includes/graphql/users.md @@ -12,7 +12,7 @@ You can ask Parse Server to [verify user email addresses]({{ site.baseUrl }}/par To sign up a new user, use the `signUp` mutation. For example: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -41,7 +41,7 @@ mutation signUp { } } ``` -```js +```json // Response { "data": { @@ -64,7 +64,7 @@ Note that a field called `sessionToken` has been returned. This token can be use After you allow users to sign up, you need to let them log in to their account with a username and password in the future. To do this, use the `logIn` mutation: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -85,7 +85,7 @@ mutation logIn { } } ``` -```js +```json // Response { "data": { @@ -108,7 +108,7 @@ Note that, when the user logs in, Parse Server generates a new `sessionToken` fo You can log in a user via a [3rd party authentication](https://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications) system (Facebook, Twitter, Apple and many more) with the `logInWith` mutation. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -140,7 +140,7 @@ mutation LoginWithFacebook { } } ``` -```js +```json // Response { "data": { @@ -166,7 +166,7 @@ You can easily do this in the GraphQL Playground. There is an option called `HTT After setting up the `X-Parse-Session-Token` header, any operation will run as this user. For example, you can run the code below to validate the session token and return its associated user: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -185,7 +185,7 @@ query viewer { } } ``` -```js +```json // Response { "data": { @@ -204,7 +204,7 @@ query viewer { You can log out a user through the `logOut` mutation. You need to send the `X-Parse-Session-Token` header and run code like the below example: -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -226,7 +226,7 @@ mutation logOut { } ``` -```js +```json // Response { "data": { @@ -247,7 +247,7 @@ mutation logOut { To use the `resetPassword` mutation your Parse Server must have an email adapter configured. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -261,7 +261,7 @@ mutation resetPassword { } } ``` -```js +```json // Response { "data": { @@ -276,7 +276,7 @@ mutation resetPassword { The verification email is automatically sent on sign up; this mutation is useful if the user didn't receive the first email. Again, an email adapter must be configured for this mutation to work. -```js +```json // Header { "X-Parse-Application-Id": "APPLICATION_ID", @@ -291,7 +291,7 @@ mutation sendVerificationEmail { } ``` -```js +```json // Response { "data": { diff --git a/_includes/parse-server/getting-started.md b/_includes/parse-server/getting-started.md index 7080e9be..6ac812a5 100644 --- a/_includes/parse-server/getting-started.md +++ b/_includes/parse-server/getting-started.md @@ -45,7 +45,7 @@ http://localhost:1337/parse/classes/GameScore You should get a response similar to this: -```js +```json { "objectId": "2ntvSpRGIK", "createdAt": "2022-01-01T12:23:45.678Z" @@ -60,7 +60,7 @@ curl -X GET \ http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK ``` -```js +```json // Response { "objectId": "2ntvSpRGIK", @@ -80,7 +80,7 @@ curl -X GET \ http://localhost:1337/parse/classes/GameScore ``` -```js +```json // The response will provide all the matching objects within the `results` array: { "results": [ diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index 26e8880a..9c97299b 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -237,7 +237,7 @@ After sending this to your Parse Server, you should see the push notifications s In your Parse Server logs, you can see something similar to -```js +```json // FCM request and response {"request":{"params":{"priority":"normal","data":{"time":"2022-01-01T12:23:45.678Z","push_id":"NTDgWw7kp8","data":"{\"alert\":\"All work and no play makes Jack a dull boy.\"}"}}},"response":{"multicast_id":5318039027588186000,"success":1,"failure":0,"canonical_ids":0,"results":[{"registration_id":"APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK","message_id":"0:1455074519347821%df0f8ea7f9fd7ecd"}]}} ``` diff --git a/_includes/parse-server/third-party-auth.md b/_includes/parse-server/third-party-auth.md index 9682e815..2cd9046a 100644 --- a/_includes/parse-server/third-party-auth.md +++ b/_includes/parse-server/third-party-auth.md @@ -50,7 +50,7 @@ Note, most of them don't require a server configuration so you can use them dire ### Facebook `authData` -```js +```json { "facebook": { "id": "user's Facebook id number as a string", @@ -59,11 +59,11 @@ Note, most of them don't require a server configuration so you can use them dire } } ``` -Learn more about [Facebook login](https://developers.facebook.com/docs/authentication/). +Learn more about [Facebook login](https://developers.facebook.com/docs/facebook-login/). ### Twitter `authData` -```js +```json { "twitter": { "id": "user's Twitter id number as a string", @@ -91,7 +91,7 @@ Learn more about [Twitter login](https://developer.twitter.com/en/docs/twitter-f ### Anonymous user `authData` -```js +```json { "anonymous": { "id": "random UUID with lowercase hexadecimal digits" @@ -103,7 +103,7 @@ Learn more about [Twitter login](https://developer.twitter.com/en/docs/twitter-f As of Parse Server 3.5.0 you can use [Sign In With Apple](https://developer.apple.com/sign-in-with-apple/get-started/). -```js +```json { "apple": { "id": "user", @@ -131,7 +131,7 @@ Learn more about [Sign In With Apple](https://developer.okta.com/blog/2019/06/04 ### Github `authData` -```js +```json { "github": { "id": "user's Github id (string)", @@ -144,7 +144,7 @@ Learn more about [Sign In With Apple](https://developer.okta.com/blog/2019/06/04 Google oauth supports validation of id_token's and access_token's. -```js +```json { "google": { "id": "user's Google id (string)", @@ -156,7 +156,7 @@ Google oauth supports validation of id_token's and access_token's. ### Instagram `authData` -```js +```json { "instagram": { "id": "user's Instagram id (string)", @@ -168,7 +168,7 @@ Google oauth supports validation of id_token's and access_token's. ### Keycloak `authData` -```js +```json { "keycloak": { "access_token": "access token from keycloak JS client authentication", @@ -205,7 +205,7 @@ The query should return all groups which the user is a member of. The `cn` attri To build a query which works with your LDAP server, you can use a LDAP client like [Apache Directory Studio](https://directory.apache.org/studio/). -```js +```json { "ldap": { "url": "ldap://host:port", @@ -221,7 +221,7 @@ If either `groupCN` or `groupFilter` is not specified, the group check is not pe Example Configuration (this works with the public LDAP test server hosted by Forumsys): -```js +```json { "ldap": { "url": "ldap://ldap.forumsys.com:389", @@ -235,7 +235,7 @@ Example Configuration (this works with the public LDAP test server hosted by For authData: -```js +```json { "authData": { "ldap": { @@ -248,7 +248,7 @@ authData: ### LinkedIn `authData` -```js +```json { "linkedin": { "id": "user's LinkedIn id (string)", @@ -260,7 +260,7 @@ authData: ### Meetup `authData` -```js +```json { "meetup": { "id": "user's Meetup id (string)", @@ -271,7 +271,7 @@ authData: ### Microsoft Graph `authData` -```js +```json { "microsoft": { "id": "user's microsoft id (string)", // required @@ -289,7 +289,7 @@ To [get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth- As of Parse Server 3.7.0 you can use [PhantAuth](https://www.phantauth.net/). -```js +```json { "phantauth": { "id": "user's PhantAuth sub (string)", @@ -302,7 +302,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### QQ `authData` -```js +```json { "qq": { "id": "user's QQ id (string)", @@ -313,7 +313,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### Spotify `authData` -```js +```json { "spotify": { "id": "user's spotify id (string)", @@ -324,7 +324,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### vKontakte `authData` -```js +```json { "vkontakte": { "id": "user's vkontakte id (string)", @@ -348,7 +348,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### WeChat `authData` -```js +```json { "wechat": { "id": "user's wechat id (string)", @@ -359,7 +359,7 @@ Learn more about [PhantAuth](https://www.phantauth.net/). ### Weibo `authData` -```js +```json { "weibo": { "id": "user's weibo id (string)",