[英]Amazon Seller Central - SP-API - Create a feed document - InvalidInput
Trying to create feed document ( here ) and I'm getting InvalidInput
error code.尝试创建提要文档( 此处)并且我收到
InvalidInput
错误代码。 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!我也尝试使用不同的
contentType
和 charset (如text/plain
)但我收到相同的错误代码!
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.我正在尝试创建提要,以便让
cartonIds
下载我在亚马逊卖家中心创建的货件的标签。
Any hint, help is more than welcome!任何提示,帮助都非常受欢迎!
Thanks!谢谢!
I use RestSharp restRequest1.AddParameter(....);我使用 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" });
给了我和你一样的错误 Invalid Input 但下面的行给了我一个响应值 restRequest1.AddJsonBody(new { contentType = "text/xml; charset=UTF-8" }); It serializes obj to json format and adds it to the request body.
它将 obj 序列化为 json 格式并将其添加到请求正文中。
I solved this issue by:我通过以下方式解决了这个问题:
requests.post(data=json.dumps(body))
Also make sure you pass the body for signing as well还要确保你也传递身体以进行签名
This code snippet in C# worked for me, i successfully uploaded a feed C# 中的这个代码片段对我有用,我成功上传了一个提要
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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.