cancel
Showing results for 
Search instead for 
Did you mean: 

How to get input parameter for a create operation?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

'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.

Answers (3)

Answers (3)

sas3
Explorer
0 Kudos

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.

Former Member
0 Kudos

Hi Krishna,

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

kammaje_cis
Active Contributor
0 Kudos

$metadata is only for the service.

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

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