Closed Suhut closed 2 years ago
Hi! Could you please provide a code snipet of your batch request so I can try to reproduce the issue? Also, which version of SAP are you working with?
Hi! Could you please provide a code snipet of your batch request so I can try to reproduce the issue? Also, which version of SAP are you working with?
SAP Business One 10.0 PL 02
Just change "https://myserver:50000/b1s/v1" to "https://myserver:50000/b1s/v2"
var serviceLayer = new SLConnection("https://myserver:50000/b1s/v2", "mydb", "manager", "mypass");
serviceLayer.AfterCall(async call =>
{
Console.WriteLine($"Request: {call.HttpRequestMessage.Method} {call.HttpRequestMessage.RequestUri}");
Console.WriteLine($"Body sent: {call.RequestBody}");
Console.WriteLine($"Response: {call.HttpResponseMessage?.StatusCode}");
var res = await call.HttpResponseMessage?.Content?.ReadAsStringAsync();
Console.WriteLine(res);
Console.WriteLine($"Call duration: {call.Duration.Value.TotalSeconds} seconds");
});
// Batch requests! Performs multiple operations in SAP in a single HTTP request
var batchRequests = new SLBatchRequest[]
{
new SLBatchRequest(HttpMethod.Post, // HTTP method
"BusinessPartners", // resource
new { CardCode = "C00001", CardName = "I'm a new BP" } // object to be sent as the JSON body
),
new SLBatchRequest(HttpMethod.Patch,
"BusinessPartners('C00001')",
new { CardName = "This is my updated name" }
),
new SLBatchRequest(HttpMethod.Delete,
"BusinessPartners('C00001')"
)
};
HttpResponseMessage[] batchResult = await serviceLayer.PostBatchAsync(batchRequests);
await serviceLayer.LogoutAsync();
Thank you
Hi! Sorry for the delayed response. I was able to reproduce the issue and pushed a fix to the dev branch, which contains the changes for the upcoming release. If you are able to test it, please let me know if it fixes the issue for you.
Thank you for your report on this. I never really used v2 so didn't catch this, I hope this fixes it.
Hi! Sorry for the delayed response. I was able to reproduce the issue and pushed a fix to the dev branch, which contains the changes for the upcoming release. If you are able to test it, please let me know if it fixes the issue for you.
Thank you for your report on this. I never really used v2 so didn't catch this, I hope this fixes it.
i have tested and it's working, big thanks brother
BatchRequest not working in sl v2.
the error that appears is: "error" : { "code" : "244", "message" : "Content ID should be specified in each change set request." }
I have filled the "contentID" parameter but still not working
Thanks youu