Closed doverradio closed 4 months ago
As a reference, https://github.com/amzn/selling-partner-api-models/issues/419 helped me immensely. Here are a few gotchas:
Gotcha 1: I'm in ruby and using the ruby-money gem.
puts 22.95.to_money.amount
=> "USD"
but 22.95.to_money.amount.inspect != "USD"
Gotcha 2:
"value_with_tax": f"{price:.2f}"
f"..."
is a python format string, not value_with_tax: { price: ... }
So you'd want something like:
{ value_with_tax: 22.95.to_money.to_f.to_s }
or:
{ value_with_tax: "22.95" }
Gotcha 3:
I needed value_with_tax
, not value
even though I'm in the U.S.
@sweetdream34310
Unfortunately, I am not currently listing to those marketplaces in EU and if there are discrepancies from the USA version, I would not be giving the proper advice. However, tomorrow I will try and see if I can find a solution for you.
ok you can use the class from https://github.com/jlevers/selling-partner-api but you 'll need to create php array and objects that follow the structure of @tbrains sugestions.
BUT... where do you get all the paths from ? ex: /attributes/item_name ???
ex: code:
$patches = array(new stdClass());
$patches[0]->op = "replace";
$patches[0]->path = "/attributes/item_name";
$patches[0]->value = array(new stdClass());
$patches[0]->value[0]->value = "Your product new name";
$patches[0]->value[0]->language_tag = "en_US";
$patches[0]->value[0]->marketplace_id = "marketplace_id ";
$body = new \SellingPartnerApi\Model\ListingsV20210801\ListingsItemPatchRequest(['product_type'=>"Product", 'patches'=>$patches]);
list_price
Quantity is similar, you have to patch the attribute fulfillment_availability,
fulfillment_channel_code = "DEFAULT" # MFN patch_data = { "productType": "PRODUCT", "patches": [{ "op": "replace", "path": "/attributes/fulfillment_availability", "value": [{ "fulfillment_channel_code": fulfillment_channel_code, "quantity": quantity }] }] }
help!! no matter how I debug, it still doesn't work, I can't find the error, please help
request: {"productType":"PRODUCT","patches":[{"op":"REPLACE","path":"/attributes/fulfillment_availability","value":[{"quantity":123,"fulfillment_channel_code":"DEFAULT"}]}]}
response: class ListingsItemSubmissionResponse { sku: XBV001234 status: INVALID submissionId: 88f30c7a6619435b8892ceb03b2659e3 issues: [class Issue { code: 99022 message: The field 'fulfillment_channel_code' for the attribute 'fulfillment_availability' does not have enough values. The required minimum is '1' value(s). severity: ERROR attributeName: fulfillment_availability }] }
{"productType":"PRODUCT","patches":[{"op":"REPLACE","path":"/attributes/fulfillment_availability","value":[{"quantity":123,"fulfillment_channel_code":"DEFAULT"}]}]}
try using "replace" instead of "REPLACE"
Sorry to bother you.
I have tested my following code without sellingPartner package.
----------
def patch_listings_item(api_url, seller_id, sku, access_token):
url = f"{api_url}/listings/2021-08-01/items/{seller_id}/{sku}"
headers = {
"Accept": "application/json",
"x-amz-access-token": f"{access_token}",
"Content-Type": "application/json; charset=utf-8",
}
payload = {
"productType": "PRODUCT",
"patches": [
{
"op": "replace",
"path": "/attributes/fulfillment_availability",
"value": [
{
"fulfillment_channel_code": "DEFAULT",
"quantity": 1,
"lead_time_to_ship_max_days": 5,
"marketplace_id": "A1VC38T7YXB528",
}
],
}
],
}
params = {"marketplaceIds": ["A1VC38T7YXB528"], "issueLocale": "ja_JP"}
response = requests.patch(url, headers=headers, data=payload, params=params)
----------
but result is ;
Failed to patch the listing item. Error: {'errors': [{'code': 'InvalidInput', 'message': 'Could not process payload', 'details': ''}]}
-----
Could you help me with your high amz sp api skill ?
Thank you
I know it's not relevant to this question, but may I ask how you guys extract these object structures from the schema? I mean programmatically?
I receive an accept but nothing changes on Amazon, it's been more than 2 hours help me
@tbrains @BashaBill
Hello! I am trying to use putListingsItem but I can't figure out what the body should look like. The example given in the documentation does not work. If anyone could help that would be amazing this is what I have currently:
@tbrains thank you list_price update success Must have the following format, which is different from purchasable_offer. {"productType":"PRODUCT","patches":[{"op":"replace","path":"/attributes/list_price","value":[{"currency":"USD","marketplace_id":"ATVPDKIKX0DER","value":14.98}]}]}
Thanks for sharing this find.
Does anyone know if changing "List Price" through xml also works? I've tried changing MaximumRetailPrice through the feed but that didn't seem to work.
How to update maximum retail price (MRP) ?
How to update maximum retail price (MRP) ?
@dialdhruv See this answer: https://github.com/amzn/selling-partner-api-models/issues/1289
hi guys, I'm really stuck on fileld merchant_suggested_asin, it's a required filed for a product type definitions (TEMPORARY_TATTOO) but I don't know how to fill it to complete my API call.
If I put
"merchant_suggested_asin": [ { "value": "WPID||ASIN" } ],
It will return as issue on
"issues": [ { "code": "8105", "message": "The data you provided for an attribute is invalid. Please refer the data definitions and resubmit with a valid value.", "severity": "ERROR", "attributeNames": [ "merchant_suggested_asin" ], "categories": [ "INVALID_ATTRIBUTE" ] } ],
If I put a random number on this, it will return issue as :
"code": "8541", "message": "The Listing data provided is different from what's already in the Amazon catalog. The item_id provided matches ASIN 0000000000, but some of the listing data contradicts what is already in the Amazon catalog. The following listing attribute value(s) conflict with Amazon catalog value(s): 'item_name' (Merchant [\"100 PCS Two Fast Race Car Temporary Tattoos Stickers Theme 2nd Birthday Party Decorations Favors Supplies Decor 2 Fast Racing Checkered Tattoo Sticker Gifts For Boys Girls School Prizes Carnival\"] / Amazon [en_US: \"Finding Peaches in the Desert\", en_IN: \"Special Education Teachers Kit: The Cartography of Syntactic Structures, Volume 6\", en_GB: \"Ksiega Diny: The Cartography of Syntactic Structures, Volume 6 (Äldre Svenska Frälsesläkter)\" and 19 other variant(s) en_SG, en_CA, en_AE, en_AU, nl_NL, de_DE, fr_FR, pl_PL, es_ES, hi_IN, zh_CN, ja_JP, es_MX, fr_BE, pt_BR, sv_SE, it_IT, ar_AE, tr_TR]), 'customer_id' (Merchant [\"692323389502\"] / Amazon []). To fix the issue, please follow these steps 1) If the product you are listing is the same as 0000000000, then update your listing's 'item_name, customer_id' attribute(s) to match Amazon's catalog value, 2) If it's not the right ASIN, make sure the item_id provided is correct, or 3) If you disagree with the data in Amazon catalog contact Selling Partner Support to start the appeal process.", "severity": "ERROR",
3. MY question is : how do I put it's as null because I want to listing a new listing that doesn't have exist item on it.
as scheme show as
` "merchant_suggested_asin": {
"title": "Merchant Suggested ASIN",
"description": "Provide an ASIN for your product if one exists. If a value is not provided, the system will attempt a match based on the External Product ID.",
"examples": [
"B007KQBXN0"
],
"type": "array",
"minItems": 1,
"minUniqueItems": 1,
"maxUniqueItems": 1,
"selectors": [
"marketplace_id",
"value"
],
"items": {
"type": "object",
"required": [
"marketplace_id",
"value"
],
"properties": {
"value": {
"title": "Merchant Suggested ASIN",
"description": "Provide an ASIN for your product if one exists. If a value is not provided, the system will attempt a match based on the External Product ID.",
"editable": false,
"hidden": false,
"examples": [
"B007KQBXN0"
],
"type": "string",
"minLength": 10,
"maxLength": 10,
"maxUtf8ByteLength": 40
},
"marketplace_id": {
"$ref": "#/$defs/marketplace_id"
}
},
"additionalProperties": false
}
},`
So it supposes can be empty but looks like it's abut from SP API Listing.
Please help me on this. Thank you
Hello. How I can update the Recommended Retail Price (RRP) or a Manufacturer’s Suggested Retail Price (MSRP)?
@xiaoyu-tamu, right now its not possible to update the business price via Listing API.
Is this still the case?
I've looked at the json schema trying to find anything that could be the business price (B2B), but I have been unsuccessful.
It would be super useful if I could update the business price through patchListingsItem instead of the xml feed.
All I want to do is use the Amazon SP-API Listings API's putListingsItem call to update the price and quantity of an item I have listed.
productType
According to the ListingsItemPutRequest docs, productType and attributes are required for this call.
Firstly, to obtain the correct productType value, you are supposed to search for a product definitions type using the Product Type Definitions API. So, I do that, and call searchDefinitionsProductTypes, just to discover my product has no matching product type.
Ultimately, I gave the value
PRODUCT
forproductType
field. As a result, thegetDefinitionsProductType
call returned an object containing an array ofpropertyNames
, shown below:On seeing this, I decide
list_price
andfulfillment_availability
must be the price and quantity and then try using these in my code below.attributes
The attributes value is also required. However, their current docs show no clear example of what to put for these values, which are where I must put price and quantity somewhere.
I found this link about patchListingsItem and tried to implement that below but got an error.
code:
// trying to update quantity... failed.
error:
I also tried using list_price :
// list_price attempt... failed.
Error (this time seems I got warmer... maybe?):
How do you correctly specify the list_price or the quantity so this call will be successful?
Just tryin to update a single item's price and quantity.