on 03-20-2015 12:26 PM
Hello Narendra,
Using the SAP NetWeaver Gateway Client,
1. Perform an HTTP GET with the following Request URI to get the service metadata:
/sap/opu/odata/sap/Z..SRV/$metadata
2. Confirm an EntitySet with the name "sample_odataset" exists, then perform an HTTP GET to get the set:
/sap/opu/odata/sap/Z..SRV/sample_odataset
3. Perform an HTTP GET for a specific entity in the set with a JSON format parameter. For example, an entity with a key value of '1' would have a Request URI as follows:
/sap/opu/odata/sap/Z..SRV/sample_odataset('1')?$format=json
4. The entity should be returned as JSON in the HTTP Response section. To use the resulting JSON for a create (HTTP PUT),
- Press the button 'Use as Request'. The X-CSRF-Token is added to the HTTP Request Header.
- Change the URI from the entity to the entity set: /sap/opu/odata/sap/Z..SRV/sample_odataset
- Select HTTP Method PUT
- Modify the HTTP Request JSON, for example, changing the key property's value.
- Execute and see what happens
I suggest starting from the above and we can go from there, e.g. if you are ultimately trying to create a record from a SAPUI5 app.
Regards,
Scott
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hedge,
There are already explained steps in the forum. You may search.
However Fire as below :
I assume id, name and address are the properties defined in your GW Model.
URL ->
/sap/opu/odata/sap/ZODATA_SERVICE_SRV/sample_odataset
HTTP Method ->
POST
Headers to be set/passed ->
Content-Type : application/json
Accept : application/json
Json Payload ->
{
"id":"101",
"name":"Nick",
"address":"London"
}
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would also need an X-CSRF-Token if you are doing and testing from outside the SAP GUI. It can be acquired by doing a GET request on the same service and setting the header as
X-CSRF-Token with value fetch
Supply this with the body as mentioned by Ashwin and you should be able to create data using JSON.
Hope this helps,
Thanks,
Rakshit Doshi
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.