🎉 New Super Feature! Elementor Integration Added to our eCommerce Mobile App.

Create REST API for PrestaShop Modules

Add REST API support to existing PrestaShop 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.

Create REST API for PrestaShop Module

  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 adds 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 8 months ago by Sam Berry


PrestaApi 7 months 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?

Sam Berry 7 months ago

you need to create a new product listing controller to get brands, I think you need to combine some classes or may be a new query, it should be checked.

Add a comment