Making your first API Call
The Subscriptions API is set of APIs used to manage subscriptions.
This guide uses the command line to make requests via cURL, but you can also use a supported SDK.
All API requests must contain a generated access token for authentication purposes. To generate an access token, you need your Application keys. Application keys are the client ID and client secret.
Once you have your client ID, you can use it to generate an access token. Requests to Subscriptions require an Authorization
header containing your access token.
This guide uses the implicit
grant type. This grant type can be thought of as read only and is most commonly used on the client side. See Authentication for more information about tokens.
Best Practices
The following steps describe how to authenticate in Subscriptions.
Get your Application keys
You must:
- Get your Application Keys.
- Make a copy of your
client_id
.
Get an access token
You can use the client_id
to make your request.
-
Make your API request where
XXXX
is replaced with yourclient_id
.curl -X POST https://useast.api.elasticpath.com/oauth/access_token \
-d "client_id=XXXX" \
-d "grant_type=implicit"The response contains the token in the field
access_token
.{
"expires": 1537779121,
"identifier": "implicit",
"expires_in": 3600,
"access_token": "0e82127a8d9c20abb3d6e48561cbfe81448956ab",
"token_type": "Bearer"
} -
Make a copy of your
access_token
. This is your implicitBearer
token that is required for future requests.
You need to re-authenticate when the access_token
expires.