1. Authentication
Requests to Moltin require an Authorization
header containing your Bearer
token. There are two token types; implicit
and client_credentials
. See Authentication for more details.
This guide will use the implicit grant type. This grant type can be thought of as READ ONLY and most commonly used client side.
Get your API keys
Head to the Moltin Dashboard, sign in, select your project and make a copy of your client_id
.
Get an access token
Using the client_id
, we can now make our very first API request. Inside your Terminal or command-line equivalent, make the following request:
A successful request will respond with something similar to:
Congratulations! 🙌
Now you'll want to make a copy of your access_token
. This is your implicit Bearer
token that is required for future requests.
You'll need to re-authenticate when the access_token
expires.
Make a request with your access token
Let's go ahead and request a new Cart. We'll use the unique reference abc
for the Cart. We'll need this when requesting the items, adding items and checking out.
Replace XXXX
below with your access_token
from above.
Inside your command-line, run the following cURL request:
You'll receive a response similar to:
Now that we have successfully authenticated and retrieved a Cart, in the next lesson we will add a custom item to the Cart.
Last updated