Creating your first Platform application
To use the Platform API you need to create a Platform Application in your Admin dashboard under
Integrations -> API .
Click the New API application button, name the app. eg. My API app
, and select admin write
access. Click Create
.
Application with write access level can perform actions such as Create, Update and Delete.
read access allows only for fetching a list of records or a single record.
After creating your app you should see a screen with Client ID
and Client Secret
note it down and keep it safe. It won't be shown again.
Now you can generate your authentication token.
Connecting with Client ID / Client Secret
curl --request POST \
--url https://demo.getvendo.com/spree_oauth/token \
--header 'Content-Type: application/json' \
--data '{
"grant_type": "client_credentials",
"client_id": "7ZY15L7crVZul8i3PZPrnpOkEURK7xnXEWRZdE6K39M",
"client_secret": "cxMZ0tbe604qj_13hibNmc3GDsXUQfpzHt9PvweihFc",
"scope": "admin write"
}'
This will return your new token:
{
"access_token": "2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3",
"token_type": "Bearer",
"expires_in": 7200,
"refresh_token": "f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c",
"scope": "admin write",
"created_at": 1539863418
}
Now you can make a call to the API:
curl --request GET \
--url https://demo.getvendo.com/api/v2/platform/orders \
--header 'Authorization: Bearer 2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3' \
--header 'Content-Type: application/json'