Skip to content

PitneyBowes/pitneybowes-shipping-api-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shippingapi

Shipping API Sample.

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.1.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/shippingapi/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 OAuth2 access token for authorization: oAuth2ClientCredentials
$config = pitneybowesShipping\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new pitneybowesShipping\Api\AddressValidationApi(
    // 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
);
$address = new \pitneybowesShipping\shippingApi.model\Address(); // \pitneybowesShipping\shippingApi.model\Address | Address object that needs to be validated.
$x_pb_unified_error_structure = true; // bool | Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs.
$minimal_address_validation = True; // bool | When set to true, the complete address (delivery line and last line) is validated but only the last line (city, state, and postal code) would be changed by the validation check.

try {
    $result = $apiInstance->verifyAddress($address, $x_pb_unified_error_structure, $minimal_address_validation);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddressValidationApi->verifyAddress: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api-sandbox.pitneybowes.com/shippingservices

Class Method HTTP request Description
AddressValidationApi verifyAddress POST /v1/addresses/verify Address validation
AddressValidationApi verifyAndSuggestAddress POST /v1/addresses/verify-suggest Address Suggestion
CarrierInfoApi getCarrierFacilities POST /v1/carrier-facility Find Carrier Facilities
CarrierInfoApi getCarrierLicenseAgreement GET /v1/carrier/license-agreements This operation retrieves a carrier's license agreement.
CarrierInfoApi getCarrierServiceRules GET /v1/information/rules/rating-services Retrieves the rules governing the carrier's services.
CarrierInfoApi getCarrierSupportedDestination GET /v1/countries This operation returns a list of supported destination countries to which the carrier offers international shipping services.
ContainerApi getContainerizedParcelsLabels POST /v1/container-manifest Create Container Manifest Label
CrossBorderQuotesApi getCrossBorderQuotes POST /v1/crossborder/checkout/quotes Cross-Border Quotes
CrossBorderQuotesApi predictedHSCode POST /v1/crossborder/hs-classification/items Predicts the HS Code for a parcel
ManifestsApi createManifest POST /v1/manifests This operation creates an end-of-day manifest
ManifestsApi reprintManifest GET /v1/manifests/{manifestId} reprintManifest
ManifestsApi retryManifest GET /v1/manifests retryManifest
ParcelProtectionApi cancelParcelProtection POST /v1/parcel-protection/void Parcel Protection Coverage
ParcelProtectionApi getParcelProtectionCoverage POST /v1/parcel-protection/create Parcel Protection Coverage
ParcelProtectionApi getParcelProtectionQuote POST /v1/parcel-protection/quote Parcel Protection Quote
ParcelProtectionApi getParcelProtectionReports GET /v1/parcel-protection/{developerId}/policies Parcel Protection Reports
PickupApi cancelPickup POST /v1/pickups/{pickupId}/cancel Cancel Pickup
PickupApi getPickupschedule POST /v1/pickups/schedule Address validation
RateParcelsApi rateParcel POST /v1/rates Use this operation to rate a parcel before you print and purchase a shipment label. You can rate a parcel for multiple services and multiple parcel types with a single API request.
ShipmentApi cancelShipment DELETE /v1/shipments/{shipmentId} cancelShipment
ShipmentApi createShipmentLabel POST /v1/shipments This operation creates a shipment and purchases a shipment label.
ShipmentApi reprintShipment GET /v1/shipments/{shipmentId} reprintShipment
ShipmentApi retryShipment GET /v1/shipments retryShipment
TrackingApi addTrackingEvents POST /v2/track/events getTrackingDetails
TrackingApi getTrackingDetails GET /v1/tracking/{trackingNumber} getTrackingDetails
TransactionReportsApi getTransactionReport GET /v4/ledger/developers/{developerId}/transactions/reports This operation retrieves all transactions for a specified period of time.

Documentation For Models

Documentation For Authorization

oAuth2ClientCredentials

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Author

support@pb.com

Packages

 
 
 

Contributors