While Using Business Central Odata Api Odata4 Facing issue

I am accessing Odata Web api , and trying to insert/ update data in Business Central.
But for few records it is throwing below error:

Microsoft.OData.Client.DataServiceRequestException: An error occurred while processing this request. —> Microsoft.OData.Client.DataServiceClientException: The server committed a protocol violation. Section=ResponseStatusLine —> System.Net.WebException: The server committed a protocol violation. Section=ResponseStatusLine at System.Net.HttpWebRequest.GetResponse() at Microsoft.OData.Client.HttpWebRequestMessage.GetResponse() — End of inner exception stack trace — — End of inner exception stack trace — at Microsoft.OData.Client.SaveResult.HandleResponse() at Microsoft.OData.Client.BaseSaveResult.EndRequest() at Microsoft.OData.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)

has anyone face same issue. please help me if someone has solution

We had a similar issue when we were deleting many records at a time. Did not dig into it, but we got that message rather than a 429 Status. Simply fetching the records in the client and retrying resolved. The auto-generated Odata client code is on my review list since we really didn’t figure out what caused it. Lots of ideas, but nothing proofed.

It is worth noting we have had bugs with the autogenerated client code for OData. Check your PK columns defined in the client code. Keys were not generated correctly when they included dates that contain closing dates. This actually resulted in incorrect data rather than an error.

Hey. Is there a solution? We are facing the same issue but can’t get our heads around.

It seems that this Error occurs randomly. I saw that it may be a false response header value but I don’t know where to change “useUnsafeHeaderParsing” to true.
Can someone help.

Best regards

This error message typically indicates an issue with the protocol or formatting of the request being sent to the server. Here are some things you can try to resolve the issue:

  1. Check that the URL you are using to access the OData web API is correct and complete.
  2. Verify that you have the correct permissions to insert/update data in Business Central.
  3. Check the format and structure of the data being sent in the request. Ensure that the data conforms to the requirements of the Business Central API.
  4. Try using a different client or tool to make the request, such as Postman or Fiddler, to see if the issue persists.
  5. Contact the support team for the OData web API or Business Central for further assistance if the issue persists. They may be able to provide more specific guidance based on the details of your situation.