on ‎2018 Oct 09 11:15 AM
I have to query an external URL to fetch some data that we have to use in our system.
Now recently the API was changed from GET to that of POST.
Earlier we had maintained the URL parameters directly in the RFC and were able to generate a successful response.
But now since the change in the API when i change the request method to post the QUERY parameters are not being passed to the Service.
For example if i my URL is "XXXX.XXXX.net/v1/oauth2/tokens?grant_type=client-credentials" the service only gets XXXX.XXXX.net/v1/oauth2/tokens. the Query parameters are being truncated by the post request.
I already checked the options in the Post
https://archive.sap.com/discussions/thread/3437183
Any other way forward? to make it work the way it was for the GET Method?
Request clarification before answering.
The URL parameters can be passed in 2 ways. The below code will give you exactly what you want (as per your postman screenshot).
1.
lo_http_client->append_field_url(
EXPORTING
name = 'fieldname' " Field Name
value = 'fieldvalue' " Field Value
CHANGING
url = 'lv_url' " URL to which to append the field
).
2.
lo_http_client->request->set_form_field(
EXPORTING
name = 'fieldname' " Name of form field
value = 'fieldvalue' " Form field value
).
cl_http_utility=>set_request_uri( request = lo_http_client->request
uri = lv_url ).
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 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.