05-27-2021 9:04 AM
Dear Experts ,
I am Trying to consume the World Check One api through ABAP .
Below is the API GET Method link which i would like to Call and get response in ABAP .
https://rms-world-check-one-api-pilot.thomsonreuters.com/V2/groups
No parameters are there to pass it just give you the info in the result.
I am facing Issue in setting up API Key and API Secret .
where i have to pass the API key and secret ?
Please guide how do i set up the API key and Secret Key so i get the response of API .
Regards
Bilal
SAP Technical
05-27-2021 2:08 PM
Hi Bilal
You can pass the api-key as below:
I hope you tested your API through POSTMAN first. If your api is working properly in POSTMAN, then you just have to replicate your header parameters like below one-by-one.
After this, make sure, if you need any Network proxy to reach this API.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
URL = url
IMPORTING
client = client.
client->request->set_header_field(
name = 'api-key'
value = '<api-key>'
).
06-04-2021 10:55 AM
Dear Mohit ,
Thank you for Reviewing and answering .
I have already done the same and still the api is giving me HTTP_Connection_failure . However On postman and on .Net Application this API is working fine .
Below is the Code on .NET , i have done it in .NET console app and its working fine in .NET .
In .Net and in Postman , api is also using the HMACSHA256 for Cryptography .
But in ABAP i know the class which make the HMAC Authorization Key which are CL_ABAP_HMAC=>CALCULATE_HMAC_FOR_CHAR OR cl_abap_message_digest=>calculate_hash_for_char
these 2 can be use and i can create the hmac string but i dont know how to use that for authorization . Below is the Sample ABAP Code Attached .
world-check-abap-program.txt
Please Assist if you know what's i am doing wrong or what i am missing in ABAP .
Regards
Bilal
SAP Technical
06-04-2021 10:58 AM
bilal.zafar the source code you attached contains hardcoded API keys / secrets, be careful!
06-04-2021 12:32 PM
Hi bilal.zafar,
First of all, I would suggest, you delete the above text files from your comments, as it contains confidential information and might cause problems to you lately.
If you are able to successfully run the API through POSTMAN, but not from your SAP AS, then please check with your Basis colleagues, if any proxy host or service is required to create the HTTP Client, as in the screenshot below:
Generally, you can find the proxy host and service information through the existing Type-G connection destinations by navigating to SM59, but make sure you get the correct values from BASIS colleagues.
Regards,
Mohit Sharma
06-10-2021 10:13 AM
Hi Mohit,
Thanks for giving all the info . the API key and secret in the code are only for testing purpose so thats why i shared , they are no longer available now .
okay sure i ll check up with Basis regarding Proxy host and service in SM59 .
Can you Guide me just 1 thing , this HMAC cryptography in the .NET code , should i use this in ABAP code or it will be in some basis config ?
If i should make the HMAC string in ABAP code , where will i pass that . ?
The main confusion is this HMAC Cryptography .
Regards
Muhammad Bilal