Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Screening /
  • World-Check One /

For a deeper look into our World Check One API, look into:

Overview |  Quickstart |  Documentation |  Downloads

avatar image
Question by d.marcella · Dec 06, 2019 at 04:40 PM · world-checkworld-check-oneerror-401php

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

And I get the information of the case back successfully.



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.

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

2 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Irfan.Khan · Dec 09, 2019 at 05:02 AM

@d.marcella

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.

Comment
Michal.Byczkowski

People who like this

1 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Michal.Byczkowski · Dec 06, 2019 at 04:53 PM

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.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
11 People are following this question.

Related Questions

php return 401 Unauthorized response, but postman success

How to generate Signature in PHP any one help me ?

Save a case with Russian characters get error message : HTTP/1.1 401 Unauthorized

Response 401 UNAUTHORIZED using RestTemplate

SEQ-4a Post Screen a case get Error 401 Unauthorized

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges