Making an API Request
This is part of the tutorial series: Getting Started:
- Getting Started
- Making an API Request
SCORM Cloud uses a RESTful API allowing you to transfer data between our server and your existing application. In order to connect with our API, you will need to specify the base path of the v2 API in your request:
https://cloud.scorm.com/api/v2/
Once you’ve done that, you will append the endpoint path you are working with to the end. As an example, let’s start by making the simplest call to SCORM Cloud, a call to the Ping Service using /ping
. As a simple curl
from the command line, that’d be:
curl -X GET https://cloud.scorm.com/api/v2/ping
Authenticate Against the API
You may have noticed that calling the Ping Service resulted in a 401
response:
{ "error": "Authorization Required." }
This is because we have not provided any credentials with the request. Let’s go ahead and add some credentials.
If you would like more information about the different types of authentication in Cloud, you can read our
Knowledge Base
article on API Authentication Types.
To add your credentials to the request, we will provide them in an HTTP Basic Auth header. For more details on what Basic Auth is, see the MDN Documentation. First we need to encode the credentials. You’ll take the App ID and Secret Key you got in the step above and concatenate them together with a :
in between, e.g., AppId:SecretKey
. Then you will Base64 encode that new string to get something that looks like: RTRDWE5SQkZFMDpTZWNyZXRLZXlBYUJiQ2NEZEVlRmZHZ0hoSWlKaktrTGxNbU5uT28=
.
Once you have that done, you can simply add it to a request like so:
curl --location --request GET 'https://cloud.scorm.com/api/v2/ping' \
--header 'Authorization: Basic RTRDWE5SQkZFMDpTZWNyZXRLZXlBYUJiQ2NEZEVlRmZHZ0hoSWlKaktrTGxNbU5uT28='
Now if we run the ping request we get a 200
response with a body that looks like:
{
"apiMessage": "pong E4CXNRBFE0",
"currentTime": "2022-09-05T19:47:19.901Z"
}
Congratulations! You have now authenticated against the SCORM Cloud API. Pass this header along with (almost) all of your requests and you will never see the “Authorization Required.” error again.
Note: Not all of our endpoints will work with the credentials from a normal application. To find out why and how to use an App Management App to authenticate with those endpoints, check out our
How to
guide on Authenticating Against the Application Management Service.
From here, you can jump off to any of the following:
- Check out our client libraries for easy integration with SCORM Cloud
- Dive into one of our tutorials for a walk-through of useful workflows
- Read more about our v2 API in our API Overview document