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.
0
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
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.5K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 560 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 281 Open PermID
- 46 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 721 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛