我尝试使用HttpWebRequest
在c#中创建带边界的批处理(多部分/混合),但总是会返回错误:
"批处理请求必须具有边界规范 \"内容类型\" 。标题"
如果我删除边界,则错误是相同的但是关于边界。任何人都可以创建一个小例子吗?
我的数据是
--batch
Content-Type: multipart/mixed;boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1
--changeset
PUT
https://api.channeladvisor.com/v1/Products(20199461)/Images('ImageFree1')?
access_token=-qK4l1JoGct6BMFXGY6t24VHbaCNpXMFsqns6QioOwE-15035
Content-type: application/json\r\n{\"Url\":\"http://iguanasell-
pics.com/photos/021G/cat/Montegrappa-Ducale-Ballpoint-pen-Mother-of-
Pearl-Resin-Rose-gold-trim-1.jpg\"}
--changeset--
--batch--
我的代码:
String token= "abcd1234";
var requestMulti =
HttpWebRequest.Create("https://api.channeladvisor.com/v1/$batch?
access_token=" + token);
requestMulti.ContentType = "multipart/mixed;boundary=changeset";
requestMulti.Method = "POST";`
谢谢!