Closed NoraYan closed 3 years ago
I think when you try to encrypt and upload the feed data( https://github.com/amzn/selling-partner-api-docs/blob/main/guides/use-case-guides/feeds-api-use-case-guide-2020-09-04.md#step-2-encrypt-and-upload-the-feed-data ), you don't have to provide any signature to the PUT request (https://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html). Maybe I can help you further if you give me the hole request
@StefanosPs Thanks for replying. I have solved the issue. If put contentType as json string directly in the step 1 request, it won't work. I need to Serialize Object to json, then it works. Here is the correct code. request.AddParameter("application/json", JsonConvert.SerializeObject(new { contentType= "text/xml; charset=utf-8" }), ParameterType.RequestBody);
Now I am facing another issue, after creating a feed, the feed processing status keeps showing IN_QUEUE after 8 hours. Does it mean it stuck or I did any thing wrong? Please help. Thanks.
@StefanosPs @NoraYan
May I ask more about upload xml ? I'm struggling on the 3rd step: createFeed, here's my steps:
Step 1 - Successfully create FeedDocuments by feeds/2020-09-04/documents
# 200 response
POST 'feeds/2020-09-04/documents'
# body
{ contentType: 'text/xml; charset=UTF-8' }
Step 2 - upload feed data
# 200 response
PUT https://tortuga-prod-eu.s3-eu-west-1.amazonaws.com/%2FNinetyDays/amzn1.tortuga.3.7ef12484-983f-4dd8-beb8-478c43a2809f.T2BTYHA9X9HH2B?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210125T151942Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=300&X-Amz-Credential=AKIAX2ZVOZFBFZP5MT6J%2F20210125%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=d9fb135db4981f6740e68eb0614c7e5c4b3383d6685c5e470eda1c9844cbf410
# headers
{ "Content-Type": 'text/xml; charset=UTF-8' }
# body
'<?xml version="1.0" encoding="utf-8"?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd"> <Header> <DocumentVersion>1.01</DocumentVersion> <MerchantIdentifier>MySellerID</MerchantIdentifier> </Header> <MessageType>Price</MessageType> <Message> <MessageID>1</MessageID> <Price> <SKU>IF-KBWK-DDLE</SKU> <StandardPrice currency="USD">24.00</StandardPrice> </Price> </Message> </AmazonEnvelope>'
Step 3 - createFeed (Failed)
POST 'feeds/2020-09-04/feeds'
# body
{
feedType: 'POST_PRODUCT_PRICING_DATA',
marketplaceIds: ["A2EUQ1WTGCTBG2", "ATVPDKIKX0DER"],
inputFeedDocumentId: 'amzn1.tortuga.3.7ef12484-983f-4dd8-beb8-478c43a2809f.T2BTYHA9X9HH2B',
}
# 400 response
{"errors"=>[{"code"=>"InvalidInput", "message"=>"Invalid request parameters", "details"=>""}]}
I get stuck in step 3, keep getting 400 response but couldn't figure out why.
Am I doing wrong on any steps?
I signed the xml
body with AES-256-CBC
in Ruby, since there's no example code, not sure I did wrongly on this step?
(But strangely I got 200 response when I upload xml data)
cipher = OpenSSL::Cipher.new('AES-256-CBC')
cipher.encrypt # set cipher to be encryption mode
cipher.key = Base64.decode64(encryption_details['key'])
cipher.iv = Base64.decode64(encryption_details['initializationVector'])
encrypted_data = cipher.update(body) + cipher.final
Appreciate any help or lint!
@cdragon1116 I have the same problem. Please let me know if you know the solution amzn/selling-partner-api-models#898
I am trying to update the inventory (Available Quantity ) using Feed Api..I can see that my Available Quantity is updated on the webpage (Status Changed Date not ) and feed state is IN_QUEUE for a long time. How long will it take for the feed state to change to DONE ?
@Jis-collab usually for small file update, it will take within an hour, large file will take within 8 hours. If more than that, it usually means stuck. It took a minute for my inventory update. I had once the feed status stuck in IN_QUEUE for more than 12 hours. Then I checked that because I had another update was stuck in IN_PROCESS for a long time and return FATAL at the end. Then I found out my xml had wrong value. I deleted all the feeds in the queue, correct the xml, then update again, it was successful.
@cdragon1116 I didn't use multiple marketplace ids in the request, can you try one to see if it works? I use ATVPDKIKX0DER
@NoraYan Hi. Did you get it to work? Does the file encryption work well for you? All the steps work for me but the answer is: The uploaded document has an illegal block size.
@StefanosPs Thanks for replying. I have solved the issue. If put contentType as json string directly in the step 1 request, it won't work. I need to Serialize Object to json, then it works. Here is the correct code.
request.AddParameter("application/json", JsonConvert.SerializeObject(new { contentType= "text/xml; charset=utf-8" }), ParameterType.RequestBody);
Now I am facing another issue, after creating a feed, the feed processing status keeps showing IN_QUEUE after 8 hours. Does it mean it stuck or I did any thing wrong? Please help. Thanks.
Can you provide the complete UploadFile method code?
@jason1004 I think this is the work flow that you need is https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide-2020-09-04.md
About the XML content you can read the document of the link above https://images-na.ssl-images-amazon.com/images/G/02/rainier/help/XML_Documentation_Intl.pdf
If the feeds api uploads an excel file, how to encrypt the data?
Using the EncryptStringToBytes_Aes method above, what you get is the result of doing the following:
@StefanosPs Thanks for replying. I have solved the issue. If put contentType as json string directly in the step 1 request, it won't work. I need to Serialize Object to json, then it works. Here is the correct code.
request.AddParameter("application/json", JsonConvert.SerializeObject(new { contentType= "text/xml; charset=utf-8" }), ParameterType.RequestBody);
Now I am facing another issue, after creating a feed, the feed processing status keeps showing IN_QUEUE after 8 hours. Does it mean it stuck or I did any thing wrong? Please help. Thanks.
hi,Can you provide me with the complete code? I didn't solve the problem, thank you,We look forward to your reply
@tanaililing @jason1004 this piece of code worked for me with Ruby to upload file contents to a pre-signed s3 url.
faraday_connection = Faraday::Connection.new(@url)
@response = faraday_connection.send(:put, nil, @data.to_json, { "Content-Type": "text/tab-separated-values; charset=UTF-8" })
So the steps which I have concluded so far for uploading the feed data are:
OpenSSL::Cipher::AES256.new(:CBC).encrypt
Base64.encode64
It returns success response for this step: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide-2020-09-04.md#step-2-encrypt-and-upload-the-feed-data
Here is error message <?xml version="1.0" encoding="UTF-8"?>
SignatureDoesNotMatch
Here is my code in c#:
Can anyone please help me out? Thanks !