Hi,
I would like to update individual sales order lines by using the OData web services. I can successfully retrieve said sales order lines from the following url:
(path-to-odata-web-service)/SalesOrder/(Document_Type='Order',No='some-sales-order-id')/SalesOrderSalesLines
but when I try to issue a PUT request to this url I get the following error:
"'PUT' requests for 'SalesOrderSalesLines' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."
I've already included the correct "If-Match" ETag header in the request.
Any ideas?
Regards,
DanÃel
*This post is locked for comments
Check this ticket for solution
I have face the same issue and found solution
Enjoy !!!
Hi,
(I had written another reply previously, but that was targeted towards another post I had created earlier this week, and was thus irrelevant)
Yes I managed to get this working.
As stated above, then in order to be able to issue a PUT request, I had to include all primary keys for the given table I was saving data to. I.e.: the values for the primary key columns had to be present BOTH in the request body, AND in the URL.
Also, one must take care of formatting the ETag correctly. It probably helps to learn about strong vs. weak ETags, i.e. sometimes the ETag is wrapped in an "envelope", which is basically the following: W/"actual-e-tag", sometimes there are single quotes there as well.
Hope this helps,
DanÃel
Hi Daniel,
I'm experiencing the same issue when trying to PUT Dimensions against an existing Sales Line that I've previously created.
Did you get any further with this problem or a potential solution?
Thanks,
Luis
The problem I had was that I wasn't referring to a single entity in the URL, i.e. I had to append the following to the url:
(Document_Type='Order',Document_No='SP123456', Line_No=10000)
By reading the $metadata document, we could determine which of the properties in the Sales Order Lines objects combined are the key to the object, and these must be in the URL.
At least this allows me to issue a PUT/PATCH request to the url. However, I'm receiving another error now:
Another user has already changed the record
which is not the case, I'm the only user. I'm passing the ETag in the If-Match header, and I'm fetching the order line records just moments before I issue the request so I've definitely got the latest ETag value. Still trying to figure out what is causing this error.
Update: I've also tried issuing a PATCH request to the same url, this gives me a slightly different error:
"'PATCH' requests for 'SalesOrderSalesLines' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156