bugfix> c# > 投稿

このエラーメッセージが表示されます。

{
    "result":"failure",
    "message":"Identifier is invalid",
    "time":"2018-05-25 15:34:13",
    "type":"items"
}
CompletedOK

これはSureDone APIに適用されます。このエラーメッセージが具体的に何を指しているのかわかりません。 Excelファイルからデータを取得していますが、間違ったコンテンツタイプを使用している可能性がありますか?ここに私のコードがあります:

private void btnLoad_Click(object sender, EventArgs e)
{
    string PathConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtChooseFile.Text + ";Extended Properties=\"Excel 8.0;HDR=Yes;\";";
    OleDbConnection conn = new OleDbConnection(PathConn);
    OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + txtLoad.Text + "$]", conn);
    DataTable dt = new DataTable();
    da.Fill(dt);
    dataGridView.DataSource = dt;
    String payload = "";
    int i = 1;
    //REST request
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
    var client = new RestClient("https://api.suredone.com/v1/editor/items/add");
    var request = new RestRequest(Method.POST);
    request.AddHeader("x-auth-token", "{token}");
    request.AddHeader("x-auth-user", "{username}");
    //request.AddHeader("content-type", "application/x-www-form-urlencoded");
    request.AddHeader("Content-type", "multipart/form-data");
    foreach(DataRow row in dt.Rows)
    {
        Hashtable postData = new Hashtable();
        postData["identifier"] = "guid";
        postData["guid"] = row["sku"].ToString();
        postData["price"] = row["price"].ToString();
        postData["title"] = row["title"].ToString();
        postData["action"] = row["action"].ToString();
        postData["stock"] = row["stock"].ToString();
        postData["msrp"] = row["msrp"].ToString();
        postData["longDescription"] = row["longdescription"].ToString();
        postData["condition"] = row["condition"].ToString();
        postData["brand"] = row["brand"].ToString();
        postData["notes"] = row["notes"].ToString();
        String formBoundary = "undefined";
        foreach (DictionaryEntry entry in postData)
        {
            payload += "--" + formBoundary + "\r\n" + 
                "Content-Disposition: form-data; name=" + 
                    entry.Key.ToString() + "\r\n\r\n" + 
                    entry.Value.ToString() + "\r\n\r\n";
        }//foreach(DictionaryEntry)CLOSE
        i++; //incrementer
    }//foreach(row) CLOSE
    //REST response 
    request.AddParameter("multipart/form-data", payload, ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    txtResponse.Text = response.Content + response.ErrorMessage + response.ResponseStatus + response.StatusCode;
    txtProducts.Text = payload;
}//button load click close