Skip to Content

Problem with POST method in ODATA API

Hi,


I have a problem regarding to POST method in ODATA service

I need to use one of the following POST/PUT/PATCH method in order to change a parameter (name of Ticket) or create new entity for Service request(Ticket)

This is my JSON format:

But when i Execute it, I recieve this message:

Uknown error. Please check the metadata and try again!

Could anyone help me how should be the format of POST or PUT?

I have tried in so many different ways and I am totally blocked :(

Regards
Sin

screenshot-12.png (33.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer

    Hi S Sin,

    You may use only PATCH to update an object, I had some issues using PUT.

    Anyway, you does not need to pass the metadata in the payload of your request. Moreover, the url cannot be $?filter=ID eq '2' this must be replaced by the UUID, just like is in the uri of your payload ('00163E03A0101ED28A8644CF8D83AE76').

    Something like this:

    Method: PATCH
    URL: https://myxxxxx.crm.ondemand.com/sap/byd/odata/cust/v1/custom_ticketodata/ServiceRequestColletion('UUID_of_Object')
    Payload: JSON
    
    
    "d" : {
    	"ID" : "id of Object",
    	"Name": "Name of Object"
    }
    

    Best regards,

    Marlos Damasceno

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Marlos Damasceno,

      It worked for me

      This is my JSON file

      {
        "d": 
      { "uri": "https://myxxxxx.crm.ondemand.com/sap/byd/odata/cust/v1/custom_ticketodata/ServiceRequestCollection('00163E03A0701ED28A8644CF8D83AE76')",
      "type": "cust.ServiceRequest",
      "etag": "W/\"datetimeoffset'2012-11-06T16%3A51%3A55.1323330Z'\"",
      "Payload": "JSON" },
      "Name": "ChangedName",
      "ETag": "/Date(1352220715132)/",
      "ObjectID": "00163E03A0701ED28A8644CF8D83AE76" }