Overview about API S-Cart

Note: This document only supports S-Cart versions from 6.5

Demo: https://s-cart.org/demo-api/

1. About api s-cart
2. Types
3. Using

1. About
The API appeared in older versions of S-Cart. However, it is only officially supported and developed from version 6.5
S-Cart uses the Laravel passport as the basis for building APIs.
The aim of the APIs is to support 3rd party applications (like mobile apps) that can work directly with S-Cart's system.
In addition, some advanced features will be developed in the near future.

2. Types
Basically, the API in S-Cart is divided into 3 main groups:
(See detailed list of supported APIs: https://s-cart.org/demo-api)
a. Customer
APIs that support end-users: login, logout, account creation, order creation, order management...
Detail: https://s-cart.org/en/developer/master/api-customer.html
b. Admin
APIs that support authentication and management through an admin account
Detail: https://s-cart.org/en/developer/master/api-admin.html
c. Front-end
APIs take website data to display externally
Detail: https://s-cart.org/en/developer/master/api-front.html

3. Using
a. Change oauth key
o use the authentication API, files oauth-private.key, oauth-public.key must exist in directory "s-cart-folder/storage"
API key
To create a new key (due to deletion or replacement), you use the command  "php artisan passport:keys --force"
API key

b. On/Off API
If you don't want to use the API, turn it off in the management page

c. Get response API
To make sure the result returned after each request is a json, add the value "Accept:application/json" to the header of each request to the API.

d. Advanced Security
 "apikey" and "apiconnection" are S-Cart-only enhanced security features. If there is no need to use them, you can turn them off in the admin.
More detail: https://s-cart.org/en/developer/master/api-connection.html

e. Security Bear

- Group API "Customer" use the access_token returned from "api/member/login"
- Group API "Admin" and "Front" use the access_token returned from "api/admin/login"

Related topics

Latest Document