Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
874 views
in Technique[技术] by (71.8m points)

python - Amazon Seller Central - SP-API - Create a feed document - InvalidInput

Trying to create feed document (here ) and I'm getting InvalidInput error code. Authentication works well (I tried other endpoints and it works) so I think headers are not the issue.

Here is my sample code:

endpoint = 'https://sellingpartnerapi-eu.amazon.com/feeds/2020-09-04/documents'
body = {
    "contentType": "text/tab-separated-values; charset=UTF-8"
}
resp = requests.post(
    endpoint,
    auth=self.amazon_auth.auth, 
    headers=self.amazon_auth.headers,
    json=body
)
return resp

Response code:

{'errors': [{'code': 'InvalidInput',
   'message': 'Invalid Input',
   'details': ''}]}

I was also trying to use different contentType and charset (like text/plain) but I receive same error code!

This is first step of Submit feed tutorial.

I'm trying to create feed so I can get cartonIds to download labels for a shipment I created over Amazon Seller Central.

Any hint, help is more than welcome!

Thanks!

question from:https://stackoverflow.com/questions/65842779/amazon-seller-central-sp-api-create-a-feed-document-invalidinput

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I use RestSharp restRequest1.AddParameter(....); gave me the same error as yours Invalid Input but the below line gave me a response value restRequest1.AddJsonBody(new { contentType = "text/xml; charset=UTF-8" }); It serializes obj to json format and adds it to the request body.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...