ODATA 'company' name issue (..."O'Reilly Corp"?)

ian_schoian_scho Member Posts: 5
edited 2020-12-21 in NAV Three Tier
For a NAV 2016 CU48 instance we have published pages as web services, to be consumed by ODATA. We consider them stable.
However we have a company called for example "O'Reilly Corp" and the apostrophe is causing us some headache.

This is an issue that should be resolved by reading the ODATA specification documentation. For example, a GET can be either in NAV (Basic Auth):
Example1:
https://YourCorp.com/NAVInstance/OData/Company('O%27%27Reilly%20Corp')/BDHIncomingDocumentListWS?$format=json&tenant=116692
Example2:
https://YourCorp.com/NAVInstance/OData/BDHIncomingDocumentListWS?$format=json&tenant=116692&company=O%27Reilly%20Corp

However, we also have a POST operation which isn't working for the first example, something like:
Example1:
https://YourCorp.com/NAVInstance/OData/Company('O%27%27Reilly%20Corp')/BDHIncomingDocumentActionsWS?tenant=116692
{ "odata.error"."message"."value": "The company \"O''Reilly Corp\" does not exist."}

Example2:
https://YourCorp.com/NAVInstance/OData/BDHIncomingDocumentActionsWS?tenant=116692&company=O%27Reilly%20Corp

Here's the body, for completeness:
Body: {
	"Action": "Create New Document",
	"Inc_Doc_Document_Type": "txt",
	"Name": "SalesXXX.txt",
	"FileContent": "PGFwcFNldHRpbmdzPgogIDxhZG..."
}

Obviously we can tell the developer consuming the web service the workaround is to use Example 2 URL, but I'd like to know if we are encoding incorrectly the 'Company' entity parameter.
Sign In or Register to comment.