fond-of-spryker/product-api

Extends the Base Spryker Product Api Modulegit initgit init

1.2.1 2019-06-06 09:32 UTC

This package is auto-updated.

Last update: 2022-05-26 17:59:37 UTC


README

Build Status PHP from Travis config license

ProductApi extends the Base Spryker Product Api Module:

  • the update and get calls are using the SKU of a product instead of the Abstract Product ID
  • touch Abstract Product on create

Installation

composer require fond-of-spryker/product-api

use rewritten "ProductApiResourcePlugin" class in Pyz ApiDenpendencyProvider

use FondOfSpryker\Zed\ProductApi\Communication\Plugin\Api\ProductApiResourcePlugin;

instead of "use Spryker\Zed\Api\ApiDependencyProvider as SprykerApiDependencyProvider;"

API

GET /api/rest/products/{sku}

curl -X GET "http://zed.yourdomain.com/api/rest/products/{sku}" \
     -H 'Content-Type: application/json' \
     

POST /api/rest/products/

curl -X POST "http://zed.yourdomain.com/api/rest/products/" \
     -H 'Content-Type: application/json' \
     -d $'{
           "data": {
             "sku": "sku",
             "id_tax_set": 1,
             "name": "Name",
             "fk_locale": "en_US",
             "attributes" : {
                 "attribute": "value"
             },
             "localized_attributes": [
              {
               "name": "Name",
               "description": "Description",
                "meta_description": "Meta Description",
                "attributes": {
                 
                },
                "locale": {
                     "id_locale": 46,
                     "locale_name": "en_US",
                     "is_active": true
                 }
              }
             ]       
           }
          }'
     

PATCH /api/rest/products/{sku}

curl -X PATCH "http://zed.yourdomain.com/api/rest/products/{sku}" \
     -H 'Content-Type: application/json' \
     -d $'{
          "data": {
            "sku": "sku",
            "id_tax_set": 1,
            "name": "Name",
            "fk_locale": "en_US",
            "attributes" : {
                "attribute": "value"
            },
            "localized_attributes": [
             {
              "name": "Name",
              "description": "Description",
               "meta_description": "Meta Description",
               "attributes": {
                
               },
               "locale": {
                    "id_locale": 46,
                    "locale_name": "en_US",
                    "is_active": true
                }
             }
            ]       
          }
     }'