亚马逊卖家平台-SP-API-创建提要文档-InvalidInput [英] Amazon Seller Central - SP-API - Create a feed document - InvalidInput

查看:708
本文介绍了亚马逊卖家平台-SP-API-创建提要文档-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.

这是我的示例代码:

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

响应码:

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

我还试图使用不同的 contentType 和字符集(例如 text/plain ),但是我收到相同的错误代码!

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

这是我正在尝试创建供稿,以便获得 cartonIds 来下载我通过Amazon Seller Central创建的货件的标签.

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!

谢谢!

推荐答案

C#中的此代码段对我有用,我成功上传了一个提要

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

我的上传方法:

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;
}

这篇关于亚马逊卖家平台-SP-API-创建提要文档-InvalidInput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆