How to activate API access in CS Cart?
author
,
Fond of IT

I want to work on web services for mobile application that is why want to know how to work  with APIs in cs cart for example to fetch products and create users etc. So what will be the steps?

  • Total 1 Answer
  • 222
Can You answer this question?
author
,
Programmer

Cs cart comes with some basic APIs already created like fetch products, get cart contents and some more. You can create your own APIs that can communicate with database get ready to be connected with your mobile application. To access/enable APIs you need to follow below steps:

API access is activated/disabled on a per-user basis.

To activate cs cart API access for a user:

1- Got to the CS-Cart admin panel in Customers section
2- Administrators Open the admin account you want to activate API access to (e.g. abc@example.com) 
3- Switch to the API access tab and check the Yes, allow this user to use the API 
4- Click on Save

The automatically generated API key will be used by this user along with their e-mail to access the API.

You need to create authorization token that is used to make API request either using postman or mobile application and that can be done as below:

$token = base64_encode("abc@example.com:1Ls2lx56a774y107xF8Y0L16W09M6PVc");

Replace above key with the one you have activate in admin panel and use as below:

Authorization:  Basic ZGhpcmFqQHdpc2l0ZWNoLmNvbToxTHMybHg1NmE3NzR5MTA3eEY4WTBMMTZXMDlNNlBWbAas