1
votes

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!

3
Hi, Did you get any solution of this? - Ashok Damani
Hi, I didn't, spent too much time for it - probably will pick up this topic again dep on development priority. For now we're parsing export csv files and doing the work. Good luck! :) - ky_aaaa

3 Answers

0
votes

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.

0
votes

I solved this issue by:

requests.post(data=json.dumps(body))

Also make sure you pass the body for signing as well

-1
votes

This code snippet in C# worked for me, i successfully uploaded a feed

My upload method:

private static bool UploadFile(byte[] encrypted, string url)
{
    bool isUploaded = false;

    var contentType = "text/tab-separated-values; charset=UTF-8";

    var parameter = new Parameter
    {
        Name = contentType,
        Value = encrypted,
        Type = ParameterType.RequestBody
    };

    var restRequest = new RestRequest(Method.PUT);
    restRequest.Parameters.Add(parameter);

    var restClient = new RestClient(url);
    var response = restClient.Execute(restRequest);

    isUploaded = response.StatusCode == System.Net.HttpStatusCode.OK;

    return isUploaded;
}