Symptom
When you are using Patch operation to update a particular record using Odata Service Explorer, you are getting the above error.
Environment
SAP Cloud for Customer
Reproducing the Issue
1. Go to Administrator work center and then navigate to OData Service Explorer.
2. Select Service c4codataapi and then click Test.
3. Choose any entity set in the Odata Console and
4. Select PATCH in the method and then enter the payload.
5. Once you click Execute, you will get the error, The specified HTTP method is not allowed for the resource identified by the Data Service Request URI
Cause
In case of Patch Operation, it is necessary to provide the Object id of the record in the Request URL. This will help the system to identify the record, Which you are going to update.
Resolution
1. Get the Object ID of the record, using the below URL
XXXXX - Tenant ID
YY - Unique ID of the record.
Once you execute the above URL, you will get the Object ID of that particular record.
2. Now, In the Request URL, Provide the following URL
https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection('ZZZZZZZZZZZ')
ZZZZZZZZZZZ - Object id of that particular record.
3. In the Request body, enter your payload and click Execute.
4. For Patch operation, send only the fields, Which you want to update. Before executing a Patch, it is necessary to check whether the field is updateable = true in metadata.
5. Metadata can be checked using the following URL :
https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$metadata?$filter=ServiceRequest
Keywords
KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem