phpsoapstreamsoap-client

No permission to use Datastream error (Royal Mail Shipping API)


I am using the Royal Mail Shipping API to 'Create a Shipment Request' & to create 'Printed Labels'.

The Printed Labels requests can be done a number of ways, I want to get this printed label in a PNG format which is easily done using the API by passing 'PNG' as a parameter. However for some reason I get the following error when I var_dump the response errors:

[errorCode] => E1184
[errorDescription] => No permission to use Datastream

My code is as follows:

public function PrintLabel($shipmentNumber, $order_tracking_id, $outputFormat = 'PDF')
{
    $time = gmdate('Y-m-d\TH:i:s');
    $request = array(
            'integrationHeader' => array(
                'dateTime' => $time,
                'version' => '2',
                'identification' => array(
                    'applicationId' => $this->api_application_id,
                    'transactionId' => $order_tracking_id
                )
            ),
            'shipmentNumber' => $shipmentNumber,
            'outputFormat' => $outputFormat, // PDF, DS, DSPDF, PNG, DSPNG
    );

    $type = 'printLabel';

    $response = $this->makeRequest($type, $request);
    return $response->label;

} // ef


$rm = new RoyalMailLabelRequest();
$response = $rm->PrintLabel('TTT000358756GB', '276831601444829801', 'PNG');
echo $response;

Can anyone suggest why I am getting this 'no permission to use datastream error'?


Solution

  • Royal Mail disable PNG label generation by default and I had to request for this to be turned on.