Skip to Content

post/put a record to odata service

Hi experts,

I have created an oData service for which the entity set is set to updateable and createable and also the create and update methods in DPC_EXT.

Now in GW client , i am getting a record using filter option and using this response as payload to create/update a record in my odata service. But the operation is failing saying "System expected the element '{http://www.w3.org/2005/Atom}entry'".

I have also added HTTP header to accept application/xml.

Regards,

jyothir aditya

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Nov 11, 2019 at 02:05 PM

    For a create or update operation you have to use a single item, an entry, as the payload.

    So you would have to look at the structure of the response of

    GET …/<OData_srv>/MyEntitySet('<key-field'>).

    For a Create request you have to perform a POST on …/<OData_srv>/MyEntitySet

    For an Updata request you have to perform a PUT on .../<OData_srv>/MyEntitySet('<key-field'>)

    See my following blog how to get such a response.

    https://blogs.sap.com/2016/06/02/odata-service-development-with-sap-gateway-using-cds-via-referenced-data-sources-how-to-implement-updates/

    Regards,

    Andre

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.