Magento 2 Unable to assign Product to category via APIMagento 2 REST API add product with categoryProduct...
US visa is under administrative processing, I need the passport back ASAP
Please, smoke with good manners
Sci fi novel series with instant travel between planets through gates. A river runs through the gates
Does holding a wand and speaking its command word count as V/S/M spell components?
How can I practically buy stocks?
Controversial area of mathematics
Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?
How exactly does Hawking radiation decrease the mass of black holes?
Is it possible to determine the symmetric encryption method used by output size?
Unexpected email from Yorkshire Bank
What does the "ep" capability mean?
Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?
How much cash can I safely carry into the USA and avoid civil forfeiture?
Was there a shared-world project before "Thieves World"?
Why do games have consumables?
A Strange Latex Symbol
Combinable filters
What happened to Captain America in Endgame?
Do I have an "anti-research" personality?
What is the relationship between spectral sequences and obstruction theory?
Is there a way to get a compiler for the original B programming language?
How to type a section sign (§) into the Minecraft client
What route did the Hindenburg take when traveling from Germany to the U.S.?
How come there are so many candidates for the 2020 Democratic party presidential nomination?
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;
}
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
bumped to the homepage by Community♦ 5 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
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
bumped to the homepage by Community♦ 5 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
add a comment |
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
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
magento2 api
edited Jan 19 '17 at 15:58
Tyler
asked Dec 27 '16 at 15:50
TylerTyler
133314
133314
bumped to the homepage by Community♦ 5 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♦ 5 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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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);
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
|
show 8 more comments
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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);
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
|
show 8 more comments
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);
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
|
show 8 more comments
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);
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);
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
|
show 8 more comments
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
|
show 8 more comments
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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