Quickstart
Making API calls isn't difficult once you know what you are doing, these steps will walk you through the process to make your first call.
Create OAuth Client
Any custom apps that you write need to have their own OAuth client which identifies the app and defines how the application will authenticate with Genesys Cloud. OAuth is not a trivial concept to learn but offers a number of advantages which outweigh the learning curve. For details on the specifics of OAuth and the different authorization types, see Authorization and then you can create an OAuth client using these steps.
Get Access Token
Once you have an OAuth Client, you can send your users through the authorization flow to obtain an access token. The authorization flow is going to be different depending on the OAuth authorization type you are using. See Implicit Grant, Authorization Code, and Client Credentials for flow specifics.
Make a request
Once you've completed the authorization flow and have an access token you can now make a request to the Platform API. Using one of the SDKs is recommended, but you can craft your own HTTP requests if you wish. You access token will need to be sent with each request in the Authorization header. It is a bearer token so the word bearer will need to come before your token value.
If we want to make a request using curl, to get the current user's information, the request would look like this:
curl -X GET -H "Content-Type: application/json" -H "Authorization: bearer <INSERT AUTH TOKEN>" "https://api.mypurecloud.com/api/v2/users/me"
or using jQuery with javascript
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.mypurecloud.com/api/v2/users/me",
"method": "GET",
"headers": {
"content-type": "application/json",
"authorization": "bearer <INSERT AUTH TOKEN>"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});