cancel
Showing results for 
Search instead for 
Did you mean: 

How to add new product. Rest api in C#

Re: How to add new product. Rest api in C#

I check in database, product wasn't create.

Re: How to add new product. Rest api in C#

[2018-02-26 08:42:49] main.CRITICAL: Report ID: webapi-5a93c889838a7; Message: Property "EntityId" does not have corresponding setter in class "Magento\Catalog\Api\Data\ProductInterface". {"exception":"[object] (Exception(code: 0): Report ID: webapi-5a93c889838a7; Message: Property \"EntityId\" does not have corresponding setter in class \"Magento\\Catalog\\Api\\Data\\ProductInterface\". at C:\\xampp\\htdocs\\magento3\\vendor\\magento\\framework\\Webapi\\ErrorProcessor.php:205, LogicException(code: 0): Property \"EntityId\" does not have corresponding setter in class \"Magento\\Catalog\\Api\\Data\\ProductInterface\". at C:\\xampp\\htdocs\\magento3\\vendor\\magento\\framework\\Reflection\\NameFinder.php:100)"} []

Re: How to add new product. Rest api in C#

okay error coming from EntityId parameters.

 

so post here final structure of your parameters which you are using

if issue solved,Click Kudos & Accept as Solution

Re: How to add new product. Rest api in C#

{
  "product": {
    "type_id": "simple",
    "attribute_set_id": 4,
    "fieldName": "A",
    "required_options": 0,
    "sku": "sku",
    "name": "abc111",
    "meta_title": null,
    "meta_description": null,
    "url_key": null,
    "custom_design": null,
    "page_layout": null,
    "options_container": null,
    "country_of_manufacture": null,
    "msrp_enabled": null,
    "msrp_display_actual_price_type": null,
    "gift_message_available": null,
    "price": 234.0,
    "special_price": null,
    "weight": 0.0,
    "msrp": null,
    "status": 1,
    "visibility": 0,
    "enable_googlecheckout": null,
    "tax_class_id": null,
    "description": null,
    "short_description": null,
    "meta_keyword": null,
    "custom_layout_update": null,
    "special_from_date": null,
    "special_to_date": null,
    "news_from_date": null,
    "news_to_date": null,
    "custom_design_from": null,
    "custom_design_to": null,
    "group_price": null,
    "tier_price": null,
    "stock_data": null,
    "Attributes": null
  }
}

Re: How to add new product. Rest api in C#

I solved this problem. I removed  not needed fields.

Re: How to add new product. Rest api in C#

Yes , I am going to update same.

 

Remove un-necessary fields which is not needed to create product.

 

Check at backend product is created or not ? if its created .

 

Then you can accept this answer as solution.

if issue solved,Click Kudos & Accept as Solution

Re: How to add new product. Rest api in C#

Ok. Thank you for your help.


I have another problem. I want to add new order document. I don't know which method to use.
I don't see method POST.

 


Please help me.

Re: How to add new product. Rest api in C#

Where you want to add order document ?

if issue solved,Click Kudos & Accept as Solution

Re: How to add new product. Rest api in C#

I want move docyment from other system to Magento.

Re: How to add new product. Rest api in C#

For that you need to create your custom web api. As by default M2 doesn't have API for this.

 

If you want to upload product image , then you can use below api : 

 

POST  /V1/products/{sku}/media

 

Refer this link for more details - http://devdocs.magento.com/swagger/#/

if issue solved,Click Kudos & Accept as Solution