🎉 We are happy to announce the Ultra Fast eCommerce Mobile App. Read More

Create REST API for PrestaShop Modules

Add REST API support to existing front-end controllers

Binshops REST API module gives you the ability to easily write your PrestaShop REST API endpoints with existing front controllers.

To add API to your PrestaShop module, you can create a new front-controller or you can add your API to the existing front-controllers within a module.

Instructions to add REST API

  1. Install PrestaShop REST API module

  2. Create a front controller within your module. You can follow these instructions (or you can use existing controllers).

  3. The module added four methods to create REST APIs. Use the following methods to process your desired method type:
    • processGetRequest to process GET
    • processPostRequest to process POST
    • processPutRequest to process PUT
    • processDeleteRequest to process DELETE

  4. You can return your data inside the methods. Sample code:
        protected function processGetRequest(){
         //your logic
            return [
                'success' => true,
                'code' => 200,
                'psdata' => null, //your data
                'message' => "Hello REST API!",

  5. Now you can call your endpoint:

    rest is keyword
    {yourmodule} type your module name
    {yourcontroller} type your controller name

Your API structure

Actually, Binshops REST module exposes API for PrestaShop core functionalities, exposes some additional useful APIs (especially in Pro version), esposes API for some of the native modules and adds API functionality to your PrestaShop modules.

So, if you need to write an API you should do it inside your module.

Posted 1 month ago by Sam Berry


PrestaApi 3 days ago

i want to display the product list page from the brand via the brand id, now how to correctly display the product list from the brand which class is responsible for this?

Add a comment