ExternalResourceClient Returning no response

Hello All,

I am using ExternalResourceClient with GET method with Bearer token to replace curl coding. 

URL and AuthKey are working on Postman. Also, POST Method on ExternalResourceClient is working well.

But GET method on ExternalResourceClient is returning 200-ok but with empty brackets, while server returns JSON response with message and status fields.

Please guide,

Prasad

Fullscreen
1
2
$response = (new ExternalResourceClient())->get($url, ['Content-Type' => "application/json", 'Authorization' => 'Bearer ' . $dmsAuthKey ]);
var_dump($response->getBody()->getContents()); //returning {}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Parents
  • Hello All, 

    Code was missing "Accept:application/json" in header. So working code is 

    Fullscreen
    1
    $response = (new ExternalResourceClient(60, 10))->get($url, ['Accept' => "application/json", 'Authorization' => 'Bearer ' . $token ]);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thanks for your assistance,

    Prasad

Reply
  • Hello All, 

    Code was missing "Accept:application/json" in header. So working code is 

    Fullscreen
    1
    $response = (new ExternalResourceClient(60, 10))->get($url, ['Accept' => "application/json", 'Authorization' => 'Bearer ' . $token ]);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thanks for your assistance,

    Prasad

Children
No Data