GET cases/{caseSystemId} works in postman, always returns 401 in php
I am trying to get a simple get request to work in php, that I've accomplished with postman without issue.
In postman, the outputted http code is the following:
GET /v1/cases/0a599156-6eb7-1e40-9bb3-2aae00039721 HTTP/1.1
Host: rms-world-check-one-api-pilot.thomsonreuters.com
Date: Fri, 06 Dec 2019 16:22:22 GMT
Authorization: Signature keyId="0b8f7e24-16d0-4672-9234-9b07b84d90d3",algorithm="hmac-sha256",headers="(request-target) host date",signature="N48t26VhJFS9KQZOqqIRumanWxfZEWwzJcRDF76f07c="
User-Agent: PostmanRuntime/7.19.0
Accept: */*
Cache-Control: no-cache
Postman-Token: d193cb45-f40d-4231-ad73-a203f00357b9,be6e8a64-807b-4184-88d3-fb1a0772b282
Host: rms-world-check-one-api-pilot.thomsonreuters.com
Accept-Encoding: gzip, deflate
Connection: keep-alive
cache-control: no-cache
my php code is as follows:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/0a599156-6eb7-1e40-9bb3-2aae00039721",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Accept: */*",
"Accept-Encoding: gzip, deflate",
"Authorization: Signature keyId=\"0b8f7e24-16d0-4672-9234-9b07b84d90d3\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"N48t26VhJFS9KQZOqqIRumanWxfZEWwzJcRDF76f07c=\"",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Date: Fri, 06 Dec 2019 16:22:22 GMT",
"Host: rms-world-check-one-api-pilot.thomsonreuters.com",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$info = curl_getinfo($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo print_r($response);
}
echo print_r($info);
And $response is always blank, and $info always shows me a 401 status code.
Best Answer
-
How are you defining your hmac function? Can you please provide the code snippet of the function that is generating the base64 encoded HMAC signature?
You will have to write a function to generate a HMAC and then append it in the authorization header as below.
Authorization: Signature keyId=\"{{API-KEY}}",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"{{BASE64-HMAC}}\""
where {{BASE64-HMAC}} is the HMAC signature generated by hashing the API secret and the dataToSign variable.
1
Answers
-
Hello @d.marcella
Unfortunately I do not have a straight answer for you, but please check https://community.developers.refinitiv.com/questions/26518/php-curl-response-is-blank.html because it was a similar issue that was already resolved.
Hope it will get you closer to your goal.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛