App Services (Usergrid) Javascript SDK Example
This sample application is a quick example to show how to make App Services (Usergrid) calls - GET, POST, PUT, DELETE - with our Javascript SDK. Also included is a login example. For more information on App Services, see our docs.

Select method to test:

Method: GET
   

To run a GET query against the API, enter the path you want to query, then push the "Run Query" button. By default, the value is "users/fred", which will translate to a call to: https://api.usergrid.com/your-org/your-app/users/fred, and will retrieve the record for fred.

Note: If you get an error here, it probably means "fred" doesn't exist. Choose "POST" to create a new "fred".

GET API Response
Method: POST
   

To run a POST query against the API, enter the path you want to call and the JSON you want to send to the server, then push the "Run Query" button. By default, the path of users, and the JSON request body of, "{"username":"fred"}" will create a new user called "fred".

Note: If you get an error here, it probably means "fred" already exists. Choose "DELETE", run the DELETE query to delete the "fred" entity, then try the POST query again

POST API Response
Method: PUT
   

To run a PUT query against the API, enter the path you want to update and the JSON you want to send to the server, then push the "Run Query" button. By default, the path of users/fred, and the JSON Request Body of "{"othervalue":"12345"}" will update the "fred" entity with the JSON Request Body.

Note: If you get an error here, it probably means "fred" doesn't exist. Choose "POST" to create a new "fred".

PUT API Response
Method: DELETE
   

To run a DELETE query against the API, enter the path you want to update and the JSON you want to send to the server, then push the "Run Query" button. By default, the path of users/fred, and the JSON Request Body of "{"othervalue":"12345"}" will update the "fred" entity with the JSON Request Body.

Note: If you get an error here, it probably means "fred" doesn't exist. Choose "POST" to create a new "fred".

DELETE API Response
Method: Log In
   

To test a login against the API, enter the username and password, then push the "Run Query" button. By default, the username is set to "fred" and the password is set to "barney", as created in the default "POST" method.

Note: If you get an error here, it probably means either the user doesn't exist, or hasn't had the password set properly. Choose "POST" to create a new "fred".

Log In API Response
// Press 'Run Query' to send the API call.