amz_sp_api
amz_sp_api copied to clipboard
POST_PRODUCT_DATA ERROR 'invalid input'
Hi @ericcj ,
i'm always getting following error while trying to upload product data, your example in the READ ME fails at the following line
Authorization code works correctly (All the steps you mentioned in the readme related to auth are working)
feeds = AmzSpApi::FeedsApiModel::FeedsApi.new(AmzSpApi::SpApiClient.new)
response = feeds.create_feed_document({"contentType" => 'text/xml; charset=utf-8'})
feed_document_id = response&.payload&.dig(:feedDocumentId)
my_feed = [my_product_feed_sample] (https://textdoc.co/MfdpRmb9BKL5TuzA)
encrypted = AmzSpApi.encrypt_feed(my_feed, response.payload)
All Above commands are working fine, Except the one below
response = feeds.create_feed({"feedType" => 'POST_PRODUCT_DATA', "marketplaceIds" => ["A1AM78C64UMOY8"], "inputFeedDocumentId" => feed_document_id})
ERROR:
Connection #1 to host sellingpartnerapi-na.amazon.com left intact
ETHON: performed EASY effective_url=https://sellingpartnerapi-na.amazon.com/feeds/2020-09-04/feeds
response_code=400 return_code=ok total_time=0.318291
HTTP response body ~BEGIN~
{
"errors": [
{
"code": "InvalidInput",
"message": "Invalid Input",
"details": ""
}
]
}
~END~
Also, Can u please point the correct product XML schema (working sample plz if you have)
Thanks so much :)
~~@AteqEjaz Did you ever resolve this?~~
You need to upload the feed content to the url. It says that step in the comment in the readme. This step from the readme
# PUT to url with lowercase "content-type" header, it's already pre-signed
Can be something like this
Faraday.put(url, encrypted , {"Content-Type" => "text/xml; charset=UTF-8"});