magento2 - Getting expected object definitions from Magento 2 REST API -


when calling magento 2 rest api schema working products using:

..rest/all/schema?services=catalogproductrepositoryv1 

the response includes:

...     "paths": {       "/v1/products": {        "post": {          "tags": [            "catalogproductrepositoryv1"          ],          "description": "create product",          "operationid": "catalogproductrepositoryv1savepost",          "parameters": [             {               "name": "$body",               "in": "body",               "schema": {                  "required": [                    "product"                  ],                  "properties": {                    "product": {                       "$ref": "#/definitions/catalog-data-product-interface"                     },                     "saveoptions": {                       "type": "boolean"                     }                 },                 "type": "object"              }           }        ],... 

how go getting definition/schema "product" object expects during post call? i.e. following definition:

"properties": {    "product": {        "$ref": "#/definitions/catalog-data-product-interface"    }, 

looks possible using swagger gui. replicate these steps , change search term whatever you're searching for:

  1. go to: http://devdocs.magento.com/swagger/index.html
  2. ctrl + f >> search whatever you're after. in case of above: catalogproductrepositoryv1
  3. expand api interface clicking it
  4. choose rest method
  5. under "parameters" there model/model schema showing payload expects.

welcome swagger! it's great when know how use it!


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -