2020 Feb 12 2:58 PM - edited 2024 Feb 03 6:41 PM
Hi experts,
I am consuming a public API(REST) inside a BAdI implementation for SAP Marketing cloud. Before I send the API request I need to encode the URL parameter to get the right response. In the BAdI implementation I can use only ABAP for key users which has specific limitations and I can't use the standard class cl_http_utility for this purpose. Is there an another way how to achieve it?
the coding looks like:
" Create HTTP client to access the outbound service
DATA(lo_client) = cl_ble_http_client=>create(
communication_scenario = 'YY1_API_GPS_COORD_MAPQUEST'
outbound_service = 'YY1_MAPQUESTAPI_REST'
).
" Creation of the service request
DATA(lo_request) = cl_ble_http_request=>create(
" method that is used for the service call
)->set_method(
if_ble_http_request=>co_method-get
).
...
" URL lo_request looks like =>
https://open.mapquestapi.com/geocoding/v1/address?key=XXXXX&location=Vyskočilova 15,Praha,CZ&thumbMaps=false
...
" Send a request and receive a response.
DATA(lo_response) = lo_client->send( lo_request ).
" Get the body of the response.
DATA(ls_body) = lo_response->get_body( ).
If I send the same GET request via my browser or via the postman app I will get the right response:

If I check the response of the API in my BAdI implementation I am getting the wrong response because the 'č' character in the name of street is missing. The URL encoding would solve this problem, but I don't know how to achieve it without the possibility to use cl_http_utility class. Any idea?

Thank you in advance.
Jaro.
Request clarification before answering.
Hi,
I solved this issue using escape() function. It works fine for me.
Regards
Jaro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jaro,
I recommend opening a ticket on component BC-SRV-APS-EXT-BL for this issue.
Best regards,
Jonathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.