cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Magento 2.1 REST API "option values ​​not specified"

SOLVED

Problem with Magento 2.1 REST API "option values ​​not specified"

Good Morning!  

I'm currently building my first Magento project, but I'm a veteran PHP developer for years. Now I face a pesky problem.  

 

My request is an import of an XML via an API to solve and that works quite well with PHP and the REST API ... At least the creation of the products and categories ...

But if I contact the "..... / options "and then post to the" ... / childs "I ALWAYS get this error:  

 

{"message": "option values ​​not specified"}  

 

Anyone experience with it? I'm looking forward to your answers!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @vittorio_emmermann

 

okay - so you mean you would like to create a configurable product options using rest api ? configuration options like color , size etc ? -

 

Because for configurable product - AKAIK - using API first you need to create the simple products with specific attributes like color and size etc and after creation of that simple product you need to create a configurable product using REST api - and assigned those simple product to this configurable product !

 

so you can manage inventory and size accordingly 

 

refer this link for the same it might helps you what you are trying to achieve  - http://brijeshtech.in/create-configurable-product-by-rest-api-in-magento2/

 

Let me know if you still have any issue on this , or if i missed out something 

if issue solved,Click Kudos & Accept as Solution

View solution in original post

8 REPLIES 8

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @vittorio_emmermann

 

Does it mean you are trying to create a product custom options using Magento 's Rest API ?

if issue solved,Click Kudos & Accept as Solution

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

 


@Manthan Dave wrote:

Hi @vittorio_emmermann

 

Does it mean you are trying to create a product custom options using Magento 's Rest API ?


Yes! Smiley Happy I've added the configurable product and the 10 simple products with the custom attribute... I worked close to this tutorial:

https://devdocs.magento.com/guides/v2.2/rest/tutorials/configurable-product/config-product-intro.htm...

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @vittorio_emmermann

 

To add custom option into the product ,refer this link - http://brijeshtech.in/magento-2-create-product-custom-options-by-rest-api/

 

This might help you to add custom options into the product

if issue solved,Click Kudos & Accept as Solution

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @Manthan Dave


@Manthan Dave wrote:

Hi @vittorio_emmermann

 

To add custom option into the product ,refer this link - http://brijeshtech.in/magento-2-create-product-custom-options-by-rest-api/

 

This might help you to add custom options into the product


Nice workarround, but not the one thing i need... Smiley Sad

 

I need attributes because of filtering and stock-management. :/ I need it for sizes..

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @vittorio_emmermann

 

okay - so you mean you would like to create a configurable product options using rest api ? configuration options like color , size etc ? -

 

Because for configurable product - AKAIK - using API first you need to create the simple products with specific attributes like color and size etc and after creation of that simple product you need to create a configurable product using REST api - and assigned those simple product to this configurable product !

 

so you can manage inventory and size accordingly 

 

refer this link for the same it might helps you what you are trying to achieve  - http://brijeshtech.in/create-configurable-product-by-rest-api-in-magento2/

 

Let me know if you still have any issue on this , or if i missed out something 

if issue solved,Click Kudos & Accept as Solution

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hello @vittorio_emmermann,

 

Please check below an example of a configurable product example

 {
      "product":{
        "sku":"KudosConfig",
        "name":"Kudos Configurable",
        "price":30,
        "status":1,
        "type_id":"configurable",
        "attribute_set_id":4,
         "extension_attributes":{
           "stock_item":{
             "is_in_stock":true
           },
           "configurable_product_options":[
             {
               "attribute__id":"193",
               "label":"Colour",
               "position":0,
               "values":[
                 {
                   "value_index":340
                 },
                 {
                   "value_index":341
                 }
               ],
               "product_id":299
             },
             {
               "attribute__id":"192",
               "label":"Size",
               "position":1,
               "values":[
                 {
                   "value_index":343
                 },
                 {
                   "value_index":342
                 }
               ],
               "product_id":299
             }
           ],
         "configurable_product_links":[
           300,
           301,
           302,
           303
         ]
       }
     }
   }

Also, here is an example of simple product with custom options

{
      "option": {
        "productSku": "24-WB04",
        "optionId": 0,
        "title": "Material",
        "type": "drop_down",
        "sortOrder": 0,
        "isRequire": false,
        "price": 0,
        "priceType": "fixed",
        "sku": "",    
        "values": [
           {
           "title": "Leather",
           "sortOrder": 0,
           "price": 0,
           "priceType": "fixed",
           "sku": ""        
          },
         {
          "title": "Rexinene",
          "sortOrder": 0,
          "price": 0,
          "priceType": "fixed",
          "sku": ""        
         },
         {
          "title": "Bata",
          "sortOrder": 0,
          "price": 0,
          "priceType": "fixed",
          "sku": ""        
         }
       ],
      "extensionAttributes": {}
      }
}
   

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Nice community! Smiley Happy

 

Its tricky to understand magento to 100% but i'll study the source!

 

Thanks for the replies, everything worked!

Re: Problem with Magento 2.1 REST API "option values ​​not specified"

Hi @vittorio_emmermann

 

Glad to know that its works for you , Happy to help and keep helping Smiley Happy

if issue solved,Click Kudos & Accept as Solution