7
有了本指南:https://msdn.microsoft.com/en-us/library/mt607719.aspx,我試圖創建批量請求以刪除報價單上的所有報價單。 我使用jQuery的Ajax的要求去做:CRM WebApi批量請求
$.ajax(
{
method: 'POST',
url: 'http://crm/api/data/v8.0/$batch',
headers: {
'Content-Type': 'multipart/mixed;boundary=batch_' + batchId,
'Accept': 'application/json'
},
data: payload
});
這是有效載荷:
–batch_SuL11egVC7
Content-Type:multipart/mixed;boundary=changeset_Sj74vxbGYr
–changeset_Sj74vxbGYr
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:1
DELETE crm/.../quotedetails(cc9b9ba8-4570-e611-80ba-0050568a6c2d) HTTP/1.1
Content-Type: application/json;type=entry
–changeset_Sj74vxbGYr
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:2
DELETE crm/.../quotedetails(cd9b9ba8-4570-e611-80ba-0050568a6c2d) HTTP/1.1
Content-Type: application/json;type=entry
–changeset_Sj74vxbGYr--
-batch_SuL11egVC7--
我沒有得到一個錯誤,但quotedetails不會被刪除。 這是響應:
--batchresponse_a3304387-0e91-4097-b9f8-a207da3aa845--
,我也發現了這個例子,我試圖與郵差複製它:Batch request - Dynamics CRM
頁眉:
Content-Type:multipart/mixed;boundary=batch_123456
Accept:application/json
Odata-MaxVersion:4.0
Odata-Version:4.0
身體:
–-batch_123456
Content-Type:multipart/mixed;boundary=changeset_123457
–-changeset_123457
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:1
POST http://onpremisesurl/api/data/v8.0/accounts HTTP/1.1
Content-Type:application/json;type=entry
{name: 'batch acount 1'}
–-changeset_123457
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:2
POST http://onpremisesurl/api/data/v8.0/accounts HTTP/1.1
Content-Type:application/json;type=entry
{name: 'batch acount 2'}
–-changeset_123457--
--batch_123456--
第一個不刪除帳戶,第二個不創建帳戶。
我做錯了什麼線索?