Skip to main content
Solved

ODP_NOT_ALLOWED - Illegal operation


Forum|alt.badge.img+5

I am trying to use projection PartsHandling in IFS10 update 8 with a C#/VB program, .NET 4.7.2, NuGet package Microsoft.OData.Client v7.7.1.

Reading many parts works:

GET /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet?$select=PartNo,Description&$skip=150&$top=50 HTTP/1.1

Reading a single part works correctly:

GET /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet?$filter=PartNo eq 'MYPART'&$top=1&$count=true HTTP/1.1

Creating a part also works:

POST /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet HTTP/1.1

But updating the same part does not work:
PATCH /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet('MYPART') HTTP/1.1

I got that error:
{"error":{"code":"ODP_NOT_ALLOWED","message":"Illegal operation."}}

I did not find documentation about ODP_NOT_ALLOWED but it probably mean "OData PATCH not allowed". I looked at the documentation in Aurena, under API Explorer, for the PartsHandling projection and the entity set PartCatalogSet allows GET/POST/DEL/PATCH. What is causing that ODP_NOT_ALLOWED error when updating a part?

Best answer by dhlelk

Hi @MicLabElmo,

This is a strange behavior.
However, it works fine when I tested with Postman on a "APP10 CORE UPD8" reference environment.

You could try the following to troubleshoot this,
1. Since you are consuming the endpoint from /main, you could try to update the same part from Aurena and check the network calls in the browser.
2. Try to update only the Description from your program (by only including Description on your request body).
3. Try removing the "If-Match" parameter from the header.
4. Test the endpoint using another tool like Postman.
5. View the actual http request generated by your program and cross check it with the request generated by Postman.

Cheers !
Dhananjaya.

View original
This topic has been closed for comments

dhlelk
Superhero
Forum|alt.badge.img+15
  • Superhero
  • March 9, 2021

Hi @MicLabElmo,

ODP_NOT_ALLOWED means the particular operation not allowed through OData provider.
For example: Performing a delete operation on a non-collection item.
 

MicLabElmo wrote:

PATCH /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet('MYPART') HTTP/1.1

Could you try adding the PartNo to path parameters since it's a required parameters,
PATCH /main/ifsapplications/projection/v1/PartsHandling.svc/PartCatalogSet(PartNo='MYPART') HTTP/1.1

Cheers !
Dhananjaya.


Forum|alt.badge.img+5
  • Do Gooder (Partner)
  • March 10, 2021

Hi,

I tested with the added PartNo= in the query but the error is the same at the end. There is no more information than error message {"error":{"code":"ODP_NOT_ALLOWED","message":"Illegal operation."}} when this problem occurs.

Michel


dhlelk
Superhero
Forum|alt.badge.img+15
  • Superhero
  • March 10, 2021

Hi @MicLabElmo,

This is a strange behavior.
However, it works fine when I tested with Postman on a "APP10 CORE UPD8" reference environment.

You could try the following to troubleshoot this,
1. Since you are consuming the endpoint from /main, you could try to update the same part from Aurena and check the network calls in the browser.
2. Try to update only the Description from your program (by only including Description on your request body).
3. Try removing the "If-Match" parameter from the header.
4. Test the endpoint using another tool like Postman.
5. View the actual http request generated by your program and cross check it with the request generated by Postman.

Cheers !
Dhananjaya.


Forum|alt.badge.img+5
  • Do Gooder (Partner)
  • March 10, 2021

Hi Dhananjaya,

The solution that worked is your point #3 : try removing the “If-Match” parameter from the header. After removing it, the Update operation worked correctly. Thank you for the help.

Michel


dhlelk
Superhero
Forum|alt.badge.img+15
  • Superhero
  • March 11, 2021
MicLabElmo wrote:

Hi Dhananjaya,

The solution that worked is your point #3 : try removing the “If-Match” parameter from the header. After removing it, the Update operation worked correctly. Thank you for the help.

Michel

Hi @MicLabElmo,

You are welcome and I'm happy to help 😊
However, I would suggest you to try out to set "If-Match" parameter value to "*" as well.

Cheers !
Dhananjaya.


Forum|alt.badge.img+3
  • Sidekick (Employee)
  • August 31, 2021

I encountered the same error when working with Microsoft.OData.Client v7.9.1. Removing or modifying the If-Match parameter didn’t work for me. 

For the PATCH request, it seems like the API expects only the modified attributes to be sent. However, the framework was not doing the desired action which resulted in the error.  

On a quick search into the Microsoft devblogs I found a related post which helped me resolved the issue. [Tutorial & Sample] Client Property Tracking for PATCH

The solution:

DataServiceCollection<PartCatalog> parts = new DataServiceCollection<PartCatalog> 
   context.PartCatalogSet.Where(o => o.PartNo == "TESTPART"));

parts[0].Description = "test description";
DataServiceResponse rs = context.SaveChanges();

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings