Postman is a good platform for testing and collaborating with your teammates either you created S2S and client callable scripts or brainCloud off-the-shelf APIs.

Installing Postman

To install Postman, simply:

Import a Collection
After installing Postman, you can import Postman Collections you have or create a new collection. The importing collection can be a JSON file or a shared link from your teammates.

The following is a shared Postman collection link that includes several requests for running user-created cloud code scripts and brainCloud build-in API calls examples, you can import it from Import From Link tab.

https://www.getpostman.com/collections/449662e8d125872ec463

Example of S2S Cloud Code script call (session-less)

Now you have created an S2S script and configured the S2S server in the brainCloud dashboard, you are able to test them from Postman.

Note: "service" : "script"; "operation" : "RUN"

Example of brainCloud build-in S2S APIs call (session-less)

Note: "service" : "itemCatalog"; "operation" : "SYS_GET_CATALOG_ITEMS_PAGE" 

Example of brainCloud S2S API auth-call (session-based)

Note: "service" : "authenticationV2"; "operation" : "AUTHENTICATE"

  • Copy down the returned sessionId from the above auth-call.

  • Make a second request, using that sessionId and setting the packetId to 1, then hit Send and check the response.

Note: "service" : "time"; "operation" : "READ"

The API calls documented in the API Ref (http://getbraincloud.com/apidocs/apiref/?raw#s2s) are mapped to discrete Services and Operations on the server.

The codes, together with operation-specific parameters (specified in the JSON data object) are used to send commands to the server.

Note: Only the API Calls in the S2S section of the API Ref can be used for S2S calls.

Using Curl

When using Curl command line with nested JSON parameters to test your S2S API call, recommend putting parameters of the API call to a JSON file, then refer to this file with --data option (-d) in curl command.

curl -d "@paraItemCat.json" -X POST https://sharedprod.braincloudservers.com/s2sdispatcher -H "Content-Type: applicaiton/json"

Example of the client API call

Every request that sent to the brainCloud client API server has an MD5 check attached to it in the request header.

The MD5 value is calculated by taking the body being sent to the API, appending the app secret to it, and then calculating the MD5 on all of that.

Only if the MD5 value is present, and checks out, brainCloud API server will accept the request.

Note: Method: POST, URL: https://sharedprod.braincloudservers.com/dispatcherv2

  • Open the imported request -- client-api-authenticateEmail (or create a request you own by following the steps below), check the content of this request in the Body textbox. You will find that is exactly the same format as the request which called from the brainCloud portal API Explorer page.

Note: The following picture is the same API call which called from brainCloud portal Design | Cloud Code | API Explorer page.

  • Copy the request content from the Body textbox and append the App Secret to it (seeing the example below).

Note: You App Secret can be found at brainCloud portal Design | Core App Info | Application IDs page.

  • Copy the whole piece of the request and paste to a MD5 encrypt tool to generate a MD5 checksum.

Note: The following are some web links of MD5 encrypt tools

https://www.miraclesalad.com/webtools/md5.php

http://onlinemd5.com/

https://md5decrypt.net/en/#answer

  • Click Postman request Headers tab, add a key with name "X-SIG", paste the MD5 checksum as the value.

  • Now you are good to go! Click the Send button and check the response from the brainCloud API server.

  • Go to brainCloud portal Monitoring | User Monitoring | User Summary to check the user you just created from Postman.

Did this answer your question?