Skip to Content
avatar image
Former Member

How to get input parameter for a create operation?

Hi,


A create operation has been created for one of my service from the gateway service. However while I use $metadata option in the URL,
/sap/opu/odata/SAP/PRODUCT/<my service>/$metadata, I get the following errors:

the error is 'The request URI is not valid. The segment '<my service>' refers to an entity set and not to a single entity'

i have tried both 'GET' and 'POST' method, the same error was got.

the parameter $metadata does work for any services whose GetEntity or GetEntitySet operation has been implemented.

My question is, does option $metadata work for Create operation or not? if yes, how to form the URL? if not, how can the service consumer get the input parameter for Create operation?

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 15, 2017 at 06:29 AM

    'Create' is an HTTP POST operation. So all the properties of the entity will be used in the request body as a JSON object.

    So do a $metadata on the service, and get to know all the properties of the entity. Next use them in the requets body.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17, 2017 at 06:01 AM

    $metadata is only for the service.

    /sap/opu/odata/SAP/PRODUCT/$metadata

    What are you expecting when you say "$metadata work for Create operation"?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 15, 2017 at 04:46 AM

    Hi Krishna,

    I want to get the parameter list of 'create' operation. thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 15, 2017 at 02:25 PM

    Correctly said by Krishna.

    If you have a deep insert, get a response with expanded entityset with "GetEntitySet". This should ideally give you all the parent as well as child entities. Now take one record with parent-child combination. Use the "Use as Request" option in the response to get the request you are going to post. Carefully remove the header information from the request and adjust the braces. Now do the Post operation to fill your data.

    For create you won't get any such parameter list to monitor what all data need to be filled to create a record.

    Add comment
    10|10000 characters needed characters exceeded