Magento 2 Unable to assign Product to category via APIMagento 2 REST API add product with categoryProduct updates via XML-RPC API not taking effectMagento SOAP API Add to cart, how to add a grouped product?Are product attribute names accessible from Magento API?Sorting issue while getting product from category ID using REST ApiCan't update my product name, PUT REST CALLUnable to update product data via REST APIMagento 2.1 REST API adding simple product with attribute set results in bad request reponseHow to get product quantity by using REST API product filterHow to Update Magento 2 configurable child products price by REST APIGET products for my cart with customer token

Why does nature favour the Laplacian?

simple conditions equation

How to stop co-workers from teasing me because I know Russian?

How to pronounce 'C++' in Spanish

Error message with tabularx

How could Tony Stark make this in Endgame?

Stop and Take a Breath!

Combinable filters

How to have a sharp product image?

Pass By Reference VS Pass by Value

Mac Pro install disk keeps ejecting itself

What does the "ep" capability mean?

How much cash can I safely carry into the USA and avoid civil forfeiture?

What is the difference between `command a[bc]d` and `command `ab,cd`

How exactly does Hawking radiation decrease the mass of black holes?

Is it possible to determine the symmetric encryption method used by output size?

What was the first Intel x86 processor with "Base + Index * Scale + Displacement" addressing mode?

Do I have to worry about players making “bad” choices on level up?

Document starts having heaps of errors in the middle, but the code doesn't have any problems in it

What language was spoken in East Asia before Proto-Turkic?

Is there an official tutorial for installing Ubuntu 18.04+ on a device with an SSD and an additional internal hard drive?

Packing rectangles: Does rotation ever help?

Fizzy, soft, pop and still drinks

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?



Magento 2 Unable to assign Product to category via API


Magento 2 REST API add product with categoryProduct updates via XML-RPC API not taking effectMagento SOAP API Add to cart, how to add a grouped product?Are product attribute names accessible from Magento API?Sorting issue while getting product from category ID using REST ApiCan't update my product name, PUT REST CALLUnable to update product data via REST APIMagento 2.1 REST API adding simple product with attribute set results in bad request reponseHow to get product quantity by using REST API product filterHow to Update Magento 2 configurable child products price by REST APIGET products for my cart with customer token






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















There has been similar issues posted without an answer unfortunately but I am posting two ways in the API to set a category on a product both of which give different errors.



The first is using the categories repository (catalogCategoryLinkRepositoryV1)



example
In body POST



 
"productLink" :

"sku" : "TEST_SKU5",
"position" : 0,
"categoryId" : "8",
"extensionAttributes":





Example Response : This is the same response regardless of what category or product.




"message": "Could not save product "%1" with position %2 to category %3",
"parameters": [
"144",
0,
"8"
]



The second is setting it under custom_attribute using the product repository in either new or update calls. Both give the same result.



When setting the custom_attribute like below regardless of what sku and category I get an error. If I leave out "category_ids" it works fine but defeats the purpose of using the API to manage product import and updates.



'custom_attributes' => array(
array( 'attribute_code' => 'category_ids', 'value' => ["8"] ),
array( 'attribute_code' => 'description', 'value' => 'Simple Description' ),
array( 'attribute_code' => 'short_description', 'value' => 'Simple Short Description' ),
)


Error being the following, which is the only error I get regardless of what combination of sku and category even if the sku is not made yet and I am creating a new product..



""message":"URL key for specified store already exists.""









share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

    – Ankit Shah
    Jan 11 '17 at 1:24











  • please add your full code for create api withing curl logic also.

    – Rakesh Jesadiya
    Jan 11 '17 at 13:43












  • I can add a new category and a new sku and I get the same error.

    – Tyler
    Jan 12 '17 at 14:30











  • I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

    – thedash
    Feb 7 '17 at 16:59

















5















There has been similar issues posted without an answer unfortunately but I am posting two ways in the API to set a category on a product both of which give different errors.



The first is using the categories repository (catalogCategoryLinkRepositoryV1)



example
In body POST



 
"productLink" :

"sku" : "TEST_SKU5",
"position" : 0,
"categoryId" : "8",
"extensionAttributes":





Example Response : This is the same response regardless of what category or product.




"message": "Could not save product "%1" with position %2 to category %3",
"parameters": [
"144",
0,
"8"
]



The second is setting it under custom_attribute using the product repository in either new or update calls. Both give the same result.



When setting the custom_attribute like below regardless of what sku and category I get an error. If I leave out "category_ids" it works fine but defeats the purpose of using the API to manage product import and updates.



'custom_attributes' => array(
array( 'attribute_code' => 'category_ids', 'value' => ["8"] ),
array( 'attribute_code' => 'description', 'value' => 'Simple Description' ),
array( 'attribute_code' => 'short_description', 'value' => 'Simple Short Description' ),
)


Error being the following, which is the only error I get regardless of what combination of sku and category even if the sku is not made yet and I am creating a new product..



""message":"URL key for specified store already exists.""









share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

    – Ankit Shah
    Jan 11 '17 at 1:24











  • please add your full code for create api withing curl logic also.

    – Rakesh Jesadiya
    Jan 11 '17 at 13:43












  • I can add a new category and a new sku and I get the same error.

    – Tyler
    Jan 12 '17 at 14:30











  • I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

    – thedash
    Feb 7 '17 at 16:59













5












5








5








There has been similar issues posted without an answer unfortunately but I am posting two ways in the API to set a category on a product both of which give different errors.



The first is using the categories repository (catalogCategoryLinkRepositoryV1)



example
In body POST



 
"productLink" :

"sku" : "TEST_SKU5",
"position" : 0,
"categoryId" : "8",
"extensionAttributes":





Example Response : This is the same response regardless of what category or product.




"message": "Could not save product "%1" with position %2 to category %3",
"parameters": [
"144",
0,
"8"
]



The second is setting it under custom_attribute using the product repository in either new or update calls. Both give the same result.



When setting the custom_attribute like below regardless of what sku and category I get an error. If I leave out "category_ids" it works fine but defeats the purpose of using the API to manage product import and updates.



'custom_attributes' => array(
array( 'attribute_code' => 'category_ids', 'value' => ["8"] ),
array( 'attribute_code' => 'description', 'value' => 'Simple Description' ),
array( 'attribute_code' => 'short_description', 'value' => 'Simple Short Description' ),
)


Error being the following, which is the only error I get regardless of what combination of sku and category even if the sku is not made yet and I am creating a new product..



""message":"URL key for specified store already exists.""









share|improve this question
















There has been similar issues posted without an answer unfortunately but I am posting two ways in the API to set a category on a product both of which give different errors.



The first is using the categories repository (catalogCategoryLinkRepositoryV1)



example
In body POST



 
"productLink" :

"sku" : "TEST_SKU5",
"position" : 0,
"categoryId" : "8",
"extensionAttributes":





Example Response : This is the same response regardless of what category or product.




"message": "Could not save product "%1" with position %2 to category %3",
"parameters": [
"144",
0,
"8"
]



The second is setting it under custom_attribute using the product repository in either new or update calls. Both give the same result.



When setting the custom_attribute like below regardless of what sku and category I get an error. If I leave out "category_ids" it works fine but defeats the purpose of using the API to manage product import and updates.



'custom_attributes' => array(
array( 'attribute_code' => 'category_ids', 'value' => ["8"] ),
array( 'attribute_code' => 'description', 'value' => 'Simple Description' ),
array( 'attribute_code' => 'short_description', 'value' => 'Simple Short Description' ),
)


Error being the following, which is the only error I get regardless of what combination of sku and category even if the sku is not made yet and I am creating a new product..



""message":"URL key for specified store already exists.""






magento2 api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 '17 at 15:58







Tyler

















asked Dec 27 '16 at 15:50









TylerTyler

133314




133314





bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

    – Ankit Shah
    Jan 11 '17 at 1:24











  • please add your full code for create api withing curl logic also.

    – Rakesh Jesadiya
    Jan 11 '17 at 13:43












  • I can add a new category and a new sku and I get the same error.

    – Tyler
    Jan 12 '17 at 14:30











  • I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

    – thedash
    Feb 7 '17 at 16:59

















  • URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

    – Ankit Shah
    Jan 11 '17 at 1:24











  • please add your full code for create api withing curl logic also.

    – Rakesh Jesadiya
    Jan 11 '17 at 13:43












  • I can add a new category and a new sku and I get the same error.

    – Tyler
    Jan 12 '17 at 14:30











  • I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

    – thedash
    Feb 7 '17 at 16:59
















URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

– Ankit Shah
Jan 11 '17 at 1:24





URL key for specified store already exists U can't use same Product/Category Name magento.stackexchange.com/questions/103438/… devdocs.magento.com/guides/v2.0/rest/list.html

– Ankit Shah
Jan 11 '17 at 1:24













please add your full code for create api withing curl logic also.

– Rakesh Jesadiya
Jan 11 '17 at 13:43






please add your full code for create api withing curl logic also.

– Rakesh Jesadiya
Jan 11 '17 at 13:43














I can add a new category and a new sku and I get the same error.

– Tyler
Jan 12 '17 at 14:30





I can add a new category and a new sku and I get the same error.

– Tyler
Jan 12 '17 at 14:30













I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

– thedash
Feb 7 '17 at 16:59





I've been following this issue for the same reason, may help: github.com/magento/magento2/issues/6671#issuecomment-251730504

– thedash
Feb 7 '17 at 16:59










1 Answer
1






active

oldest

votes


















0














You have to check below code for set product in category with position,



 <?php 
$url="http://127.0.0.1/magento2.1/"; //your custom site url...
$token_url=$url."rest/V1/integration/admin/token";

//Below 9 is category id....
$product_url=$url. "rest/V1/categories/9/products";
$username="admin";
$password="admin123";
//Authentication rest API magento2, get access token
$ch = curl_init();
$data = array("username" => $username, "password" => $password);
$data_string = json_encode($data);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken= json_decode($token);

//9 is category id...
$sampleProductData = array(
"sku" => "24-MB01",
"position" => 5,
"category_id" => "9",
"extension_attributes" => array()
);
$categoryData = json_encode(array('productLink' => $sampleProductData));

$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $categoryData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);





share|improve this answer























  • hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

    – Teja Bhagavan Kollepara
    Jan 12 '17 at 12:29












  • Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

    – Tyler
    Jan 12 '17 at 14:29











  • You can just try with above solutions. I have test it.

    – Rakesh Jesadiya
    Jan 12 '17 at 14:44











  • This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

    – Tyler
    Jan 12 '17 at 16:07











  • Have you checked category with id 9 exist or not for your admin?

    – Rakesh Jesadiya
    Jan 12 '17 at 16:09











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f152057%2fmagento-2-unable-to-assign-product-to-category-via-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You have to check below code for set product in category with position,



 <?php 
$url="http://127.0.0.1/magento2.1/"; //your custom site url...
$token_url=$url."rest/V1/integration/admin/token";

//Below 9 is category id....
$product_url=$url. "rest/V1/categories/9/products";
$username="admin";
$password="admin123";
//Authentication rest API magento2, get access token
$ch = curl_init();
$data = array("username" => $username, "password" => $password);
$data_string = json_encode($data);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken= json_decode($token);

//9 is category id...
$sampleProductData = array(
"sku" => "24-MB01",
"position" => 5,
"category_id" => "9",
"extension_attributes" => array()
);
$categoryData = json_encode(array('productLink' => $sampleProductData));

$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $categoryData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);





share|improve this answer























  • hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

    – Teja Bhagavan Kollepara
    Jan 12 '17 at 12:29












  • Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

    – Tyler
    Jan 12 '17 at 14:29











  • You can just try with above solutions. I have test it.

    – Rakesh Jesadiya
    Jan 12 '17 at 14:44











  • This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

    – Tyler
    Jan 12 '17 at 16:07











  • Have you checked category with id 9 exist or not for your admin?

    – Rakesh Jesadiya
    Jan 12 '17 at 16:09















0














You have to check below code for set product in category with position,



 <?php 
$url="http://127.0.0.1/magento2.1/"; //your custom site url...
$token_url=$url."rest/V1/integration/admin/token";

//Below 9 is category id....
$product_url=$url. "rest/V1/categories/9/products";
$username="admin";
$password="admin123";
//Authentication rest API magento2, get access token
$ch = curl_init();
$data = array("username" => $username, "password" => $password);
$data_string = json_encode($data);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken= json_decode($token);

//9 is category id...
$sampleProductData = array(
"sku" => "24-MB01",
"position" => 5,
"category_id" => "9",
"extension_attributes" => array()
);
$categoryData = json_encode(array('productLink' => $sampleProductData));

$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $categoryData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);





share|improve this answer























  • hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

    – Teja Bhagavan Kollepara
    Jan 12 '17 at 12:29












  • Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

    – Tyler
    Jan 12 '17 at 14:29











  • You can just try with above solutions. I have test it.

    – Rakesh Jesadiya
    Jan 12 '17 at 14:44











  • This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

    – Tyler
    Jan 12 '17 at 16:07











  • Have you checked category with id 9 exist or not for your admin?

    – Rakesh Jesadiya
    Jan 12 '17 at 16:09













0












0








0







You have to check below code for set product in category with position,



 <?php 
$url="http://127.0.0.1/magento2.1/"; //your custom site url...
$token_url=$url."rest/V1/integration/admin/token";

//Below 9 is category id....
$product_url=$url. "rest/V1/categories/9/products";
$username="admin";
$password="admin123";
//Authentication rest API magento2, get access token
$ch = curl_init();
$data = array("username" => $username, "password" => $password);
$data_string = json_encode($data);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken= json_decode($token);

//9 is category id...
$sampleProductData = array(
"sku" => "24-MB01",
"position" => 5,
"category_id" => "9",
"extension_attributes" => array()
);
$categoryData = json_encode(array('productLink' => $sampleProductData));

$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $categoryData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);





share|improve this answer













You have to check below code for set product in category with position,



 <?php 
$url="http://127.0.0.1/magento2.1/"; //your custom site url...
$token_url=$url."rest/V1/integration/admin/token";

//Below 9 is category id....
$product_url=$url. "rest/V1/categories/9/products";
$username="admin";
$password="admin123";
//Authentication rest API magento2, get access token
$ch = curl_init();
$data = array("username" => $username, "password" => $password);
$data_string = json_encode($data);

$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken= json_decode($token);

//9 is category id...
$sampleProductData = array(
"sku" => "24-MB01",
"position" => 5,
"category_id" => "9",
"extension_attributes" => array()
);
$categoryData = json_encode(array('productLink' => $sampleProductData));

$setHaders = array('Content-Type:application/json','Authorization:Bearer '.$adminToken);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $categoryData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 12 '17 at 12:27









Rakesh JesadiyaRakesh Jesadiya

30.5k1577126




30.5k1577126












  • hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

    – Teja Bhagavan Kollepara
    Jan 12 '17 at 12:29












  • Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

    – Tyler
    Jan 12 '17 at 14:29











  • You can just try with above solutions. I have test it.

    – Rakesh Jesadiya
    Jan 12 '17 at 14:44











  • This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

    – Tyler
    Jan 12 '17 at 16:07











  • Have you checked category with id 9 exist or not for your admin?

    – Rakesh Jesadiya
    Jan 12 '17 at 16:09

















  • hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

    – Teja Bhagavan Kollepara
    Jan 12 '17 at 12:29












  • Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

    – Tyler
    Jan 12 '17 at 14:29











  • You can just try with above solutions. I have test it.

    – Rakesh Jesadiya
    Jan 12 '17 at 14:44











  • This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

    – Tyler
    Jan 12 '17 at 16:07











  • Have you checked category with id 9 exist or not for your admin?

    – Rakesh Jesadiya
    Jan 12 '17 at 16:09
















hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

– Teja Bhagavan Kollepara
Jan 12 '17 at 12:29






hi rakesh, Please open once this url. and place order with cod. place order is not working. depoto.com its urgent to me. sorry for asking here

– Teja Bhagavan Kollepara
Jan 12 '17 at 12:29














Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

– Tyler
Jan 12 '17 at 14:29





Look at your array for adding to category and then look at mine, they are almost identical. categoryId and category_id as the key result in the same error. Setting a different position doesn't change that.

– Tyler
Jan 12 '17 at 14:29













You can just try with above solutions. I have test it.

– Rakesh Jesadiya
Jan 12 '17 at 14:44





You can just try with above solutions. I have test it.

– Rakesh Jesadiya
Jan 12 '17 at 14:44













This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

– Tyler
Jan 12 '17 at 16:07





This is the result of using your code : ""message":"Could not save product "%1" with position %2 to category %3","parameters":["237",5,"17"]"

– Tyler
Jan 12 '17 at 16:07













Have you checked category with id 9 exist or not for your admin?

– Rakesh Jesadiya
Jan 12 '17 at 16:09





Have you checked category with id 9 exist or not for your admin?

– Rakesh Jesadiya
Jan 12 '17 at 16:09

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f152057%2fmagento-2-unable-to-assign-product-to-category-via-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2