Skip to content
NHS logo

Donate

Get Urgent Help

API Demo

Details Used:

client_id: 1f11789ff3f14da6a9c8285e28d1b607

client_secret: d7b4654aCd784c0E979fF107E17F32D1

Postcode Check

Endpoint:

https://referral-exp-v1-dev-3eksi3.hex6co.gbr-e1.cloudhub.io/api/gp-details?postCode=SK17+9BZ&name=Buxton

Full Request:

$curl = curl_init();

$api_endpoint = 'https://referral-exp-v1-dev-3eksi3.hex6co.gbr-e1.cloudhub.io/api/gp-details?postCode=SK17+9BZ&name=Buxton';

curl_setopt_array($curl, [
    CURLOPT_URL => $api_endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'client_id: 1f11789ff3f14da6a9c8285e28d1b607',
        'client_secret: d7b4654aCd784c0E979fF107E17F32D1'
    ]
]);

$response = curl_exec($curl);

$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if (curl_errno($curl)) {
    var_dump('Curl error: ' . curl_error($curl));
}

curl_close($curl);

$data = json_decode($response, true);

print_r($response);
print_r($data);

                    

Response:

{
  "error": {
    "code": 500,
    "reason": "Internal Server Error",
    "message": "Required parameter 'value' was assigned with value '#[attributes.queryParams.postcode]' which resolved to null. Required parameters need to be assigned with non null values"
  }
}Array
(
    [error] => Array
        (
            [code] => 500
            [reason] => Internal Server Error
            [message] => Required parameter 'value' was assigned with value '#[attributes.queryParams.postcode]' which resolved to null. Required parameters need to be assigned with non null values
        )

)

Delivered with