on ‎2014 Feb 27 10:29 AM
Dear,
When I test a json deep insert (For eaxmple:a POST on /sap/opu/odata/sap/<Gateway_service>/<GW_Data>Set in the GW Client then it returns the result in atom/xml....
If i add ?$format=json to the call i receive following error:
The Data Services Request contains SystemQueryOptions that are not allowed for this Request Type
Is there a way to get the response in json for a POST deep insert/create?
Thanks in advance!
Kind Regards,
Robin
Request clarification before answering.
A simple trick to get a json response from a POST request when testing with either the Gateway Client or any browser-based REST Client is to add the following header to the request:
Accept application/json
No need to use $batch in this case unless you're really batching requests.
You can use this with any HTTP method supported.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How will we use the POST method for deep entity if we have multiple level of associations.
/sap/opu/odata/SAP/ZCREATE_SALES_ORDER/SOHeaderSet?$expand=NavToItem,NavToHTexts,NavToItem/NavToSllines,NavToItem/NavToTexts
It is giving error:
The Data Services Request contains SystemQueryOptions that are not allowed for this Request Type
The same link works for GET but not for POST.
The association is linked as :
1. Header to Item. (NavToItem)
2. Header to Header Texts. (,NavToHTexts)
3. Item to Schedule Lines. (,NavToItem/NavToSllines)
4. Item to Item Texts (NavToItem/NavToTexts)
Hi Robin,
This error is coming from method PROCESS_ENTITY_SET (/IWCOR/CL_DS_PROC_DISPATCHER)
Below system query options are not allowed for POST.
" system query option are not allowed
IF io_uri->expand IS NOT INITIAL OR
io_uri->select IS NOT INITIAL OR
io_uri->filter IS BOUND OR
io_uri->orderby IS BOUND OR
io_uri->skip IS NOT INITIAL OR
io_uri->top IS NOT INITIAL OR
io_uri->skiptoken IS NOT INITIAL OR
io_uri->inlinecount IS NOT INITIAL OR
io_uri->format IS NOT INITIAL.
RAISE EXCEPTION TYPE /IWCOR/cx_DS_proc_error
EXPORTING
textid = /IWCOR/cx_DS_proc_error=>invalid_system_query_option.
ENDIF.
May be using batch call you can get response in JSON format. I mean using batch method, 1st give call to POST and then to GET which allows $format.
again on client side (may be ui5), you can easily convert response in json format with available APIs.
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.