Admin API
Getting Started
At the core of 29 Next is the Admin API. It provides RESTful access to products, customers, orders, transactions, support tickets, and more all in json format.
https://<store>.29next.store/api/admin/
Use API Explorer
Access the API explorer on your store at https://<store>.29next.store/api/admin/
to explore the API methods available.
Authentication
The Admin API uses Oauth 2 authorization protocol to manage access to your store's resources. Oauth Apps (and associated access tokens) can be tailored with object level permission to ensure that each integrated service only has access to necessary objects.
Before using the Admin API, you'll need to create a store and create an Oauth App necessary for API access. To create an Oauth App, navigate to Settings > API Access and create a new Oauth App with applicable permissions to retrieve your Access Token. It is recommended to create unique Oauth Apps per external system so that you can revoke as needed.
Use your Oauth App Access Token in the request headers to access the API.
curl -X GET -H "Authorization: Bearer <YOUR API TOKEN>" GET "https://<store>.29next.store/api/admin/" -H "accept: application/json"
import requests
oauth_access_token = '<YOUR OAUTH TOKEN>'
headers = {'Authorization': 'Bearer ' + oauth_access_token }
request = requests.get("https://<store>.29next.store/api/admin/orders/", headers=headers)
API Tokens Are Deprecated
Legacy API Tokens are now deprecated in favor of Oauth App Tokens. If you are currently using Legacy API Tokens, it's recommended to update your integration as they will be removed at a future date.
Basic Examples
Create Customer
Create a new customer on your store.
import requests
oauth_access_token = '<YOUR OAUTH TOKEN>'
headers = {'Authorization': 'Bearer ' + oauth_access_token }
data = {
'email': 'john@example.co',
'first_name': 'John',
'last_name': 'Test',
'phone_number': '+18125559988',
'language': 'en',
"accepts_marketing": True
}
request = requests.post(
"https://<store>.29next.store/api/admin/orders/", headers=headers, data=data)
Create Order
Create an order with PayPal One click flow.
import requests
oauth_access_token = '<YOUR OAUTH TOKEN>'
headers = {'Authorization': 'Bearer ' + oauth_access_token }
data = {
'lines': [
{
'stockrecord_id': 1,
'quantity': 1
}
],
'payment_method': 'paypal',
'payment_details': {
'payment_return_url': '<YOUR PAYMENT RETURN URL>' // see redirect method guides
}
request = requests.post(
"https://<store>.29next.store/api/admin/orders/", headers=headers, data=data)