Giter VIP home page Giter VIP logo

royal-mail-shipping-rest-api-client's Introduction

Royal Mail API Shipping V2

This API specification details the requirements for integrating with Royal Mail Pro Shipping V2 REST API. It specifically covers how the Royal Mail Pro Shipping API can be used by business customers to conduct shipping activity with Royal Mail and provides the technical information to build this integration. This specification must be used with the relevant accompanying specifications for customers wishing to interface their systems with Royal Mail services. Royal Mail Pro Shipping API exposes a fully RESTful service that allows account customers to create shipments, produce labels, and produce documentation for all the tasks required to ship domestic items with Royal Mail. Built on industry standards, Royal Mail Pro Shipping V2 API provides a simple and low cost method for customers to integrate with Royal Mail, and allows them to get shipping quickly. There are no costs to customers for using the Royal Mail Pro Shipping V2 API services, however customers’ own development costs must be covered by the customer developing the solution. Royal Mail will not accept any responsibility for these development, implementation and testing costs. Customers should address initial enquiries regarding development of systems for these purposes to their account handler.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.21
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/zVPS/royal-mail-shipping-rest-api-client.git"
    }
  ],
  "require": {
    "zVPS/royal-mail-shipping-rest-api-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once 'vendor/autoload.php';

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
// Configure API key authorization: clientSecret
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Secret', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Secret', 'Bearer');

$apiInstance = new RoyalMail\Shipping\Rest\Api\RoyalMail\Shipping\Rest\Api\ManifestApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \RoyalMail\Shipping\Rest\Api\models\ManifestRequest(); // \RoyalMail\Shipping\Rest\Api\models\ManifestRequest | 
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.

try {
    $result = $apiInstance->manifestPost($body, $xRMGAuthToken);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ManifestApi->manifestPost: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: clientID
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Id', 'Bearer');
// Configure API key authorization: clientSecret
$config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('X-IBM-Client-Secret', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\Shipping\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-IBM-Client-Secret', 'Bearer');

$apiInstance = new RoyalMail\Shipping\Rest\Api\RoyalMail\Shipping\Rest\Api\ManifestApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$xRMGAuthToken = "xRMGAuthToken_example"; // string | Authorisation token required to invoke this operation. Can be retrieved by invoking the **_/token** operation.
$salesOrderNumber = "salesOrderNumber_example"; // string | The Sales Order Number, which is available via the GUI the day after the manifest was created.
$manifestBatchNumber = "manifestBatchNumber_example"; // string | This is the batch number to print and is returned by a prior call to create manifest operation.

try {
    $result = $apiInstance->manifestPut($xRMGAuthToken, $salesOrderNumber, $manifestBatchNumber);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ManifestApi->manifestPut: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to ///shipping/v2

Class Method HTTP request Description
ManifestApi manifestPost POST /manifest Create shipping manifest.
ManifestApi manifestPut PUT /manifest Create manifest image.
ShipmentApi domesticPost POST /domestic Create a domestic shipment.
ShipmentApi shipmentNumberDelete DELETE /{shipmentNumber} Cancel a shipment.
ShipmentApi shipmentNumberLabelPut PUT /{shipmentNumber}/label Create shipment label.
ShipmentApi shipmentNumberPut PUT /{shipmentNumber} Update a shipment.
ShipmentApi shipmentsPost POST /shipments Create an international or domestic shipment.
ShipmentApi shipmentsShipmentNumberDocumentsPut PUT /shipments/{shipmentNumber}/documents Create international documents.
TokenApi getToken GET /token Method to get a JSON Web Token (JWT).

Documentation For Models

Documentation For Authorization

clientID

  • Type: API key
  • API key parameter name: X-IBM-Client-Id
  • Location: HTTP header

clientSecret

  • Type: API key
  • API key parameter name: X-IBM-Client-Secret
  • Location: HTTP header

Author

royal-mail-shipping-rest-api-client's People

Contributors

caffe1neadd1ct avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.