Platform REST API 2.0 (Beta)

REST API v2.0 represents a significant effort to improve the capabilities of the APIs, which are now fully REST Compliant and following latest OpenAPI(v3) Standard using Swagger with an enriched set of API to cover more functionality. Currently, Platform supports Data APIs for object, user and customer.

For documentation on Platform REST API 2.0, see REST API v2.0 Documentation.

REST API v2.0 Authentication

You can authenticate REST APIs in two ways:

1. JSON Web Token

JSON Web Token is a mechanism to authenticate APIs. To access any REST 2.0 APIs, a user needs to pass JW Token in the request header.

To generate JW token, access the following URL with basic authentication:

http://{HostName}/rest/api2/login/

This returns JW Token and URL. Use the URL in subsequent requests. The default expiry time of JW Token is 30 minutes. User can change the expiry time under Built-in security levels.htm

Example:

curl -X POST \

http://{HostName}/rest/api2/login \

-H 'Authorization: Basic Y2hyb21lQHlvcG1haWwuY29tOnByb2dyZXNz' \

Output:

{

"JWT": "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlSWQiOjEzNTU2LCJjdXN0SWQiOjEyMDExLCJ1c2VySWQiOjE4MDM2LCJqdGkiOiJmM2YzNTk3Yi1mOTE2LTRhM2ItOGEwZC1mMTI4ZTk2MmY0N2YiLCJleHAiOjE1NjM0MTE3NTV9.amwNE5b7WoP2mdqOiy3N3lqb1-2uudj5DEmnpzCrt1Q",

"url": "http://{HostName}/prod1/api2/"

}

Example for invoking REST API using JW Token:

curl -X GET \

'http://{HostName}/prod1/api2/data/<object_integration_name>/record/<id>' \

-H '"JWT": "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlSWQiOjEzNTU2LCJjdXN0SWQiOjEyMDExLCJ1c2VySWQiOjE4MDM2LCJqdGkiOiJmM2YzNTk3Yi1mOTE2LTRhM2ItOGEwZC1mMTI4ZTk2MmY0N2YiLCJleHAiOjE1NjM0MTE3NTV9.amwNE5b7WoP2mdqOiy3N3lqb1-2uudj5DEmnpzCrt1Q"

2. UI Session

User can directly access the APIs if logged-in into either Platform or portal. This enables users to directly invoke the REST API without a need of authentication.

The following are the examples to invoke the REST APIs from a logged-in session:

$.ajax({url: "http://<hostName>/prod1/api2/data/<object_integration_name>/record/<id>", success: function(val){ console.log(val);}});