Skip to content

PitneyBowes/pitneybowes-360api-shipping-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for shipping

Introduction

The Shipping APIs include a variety of operations that allow users to manage and track their shipping requests.

Some of the key API operations available in the Shipping API includes:

Shipment API

Operation Description
Get Carriers This operation fetches all onboarded carriers. Typically, user will use this service to get list of onboarded carriers and supported properties for those carriers.
Get Countries This operation fetches list of supported destination countries for a provided carrier and origin country.
Get Services This operation fetches a list of supported services for a carrier with respect to specific origin and destination country.
Get ParcelTypes This operation fetches ParcelTypes based on carrier, origin and destination country.
Get Special Services This operation fetches Special Services for a given carrier, service, origin and destination country.
Get Carrier Accounts This operation retrieves onboarded Carriers with their Carrier Account Ids which uniquely identify multiple accounts of same carrier.
Rate Shop and Get Single Rate This API contains 2 operations, rate shop and single rate. Rate shop will fetch rates for all carrier services based on the given addresses (From and To), weight, and dimension for given parcelType. Single rate will get rate for specific service and special service (if requested) based on the given addresses (From and To), weight, and dimension, parcelType and serviceId with or without specialServices. Single rate will be used mainly to a rate a shipment before creating shipment.
Create Shipment This operation creates a new Shipment or Shipment Label. This is for both Domestic and International.
Get All Shipments This operation fetches all created Shipments.
Get Shipment by Id Retrieves single shipment using Shipment Id.
Reprint Shipment This operation reprints Shipment by the shipmentId. It retrieves an existing shipping label to reprint. The API sends the shipmentId returned by the original Created Shipment request. Use this only if the shipping label in the Create Shipment response was spoilt or lost.
Cancel Shipment This operation cancels previously created shipment.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Install 360API shipping library

go get github.com/PitneyBowes/pitneybowes-360api-shipping-go 

Put the package under your project folder and add the following in import:

import shipping "github.com/PitneyBowes/pitneybowes-360api-shipping-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value shipping.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), shipping.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value shipping.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), shipping.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using shipping.ContextOperationServerIndices and shipping.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), shipping.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), shipping.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

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

Class Method HTTP request Description
AddressAPI AddressSuggest Post /api/v1/address/suggest Address Suggest
AddressAPI AddressValidate Post /api/v1/address/verify Address Validate
BatchAPI BulkImportAPI Post /api/v1/shipments/importUrl Bulk Import Shipments
BatchAPI BulkImportAPIERR Post /api/v1/err/shipments/importUrl Bulk Import Shipments ERR
BatchAPI CreateBulkShipmentsAPI Post /api/v1/bulkShipments Create Bulk Shipments
BatchAPI CreateBulkShipmentsAPIERR Post /api/v1/err/bulkShipments Create Bulk Shipments ERR
BatchAPI GetBatchStatusAPI Get /api/v1/shipments/batch/{batchId}/status Get Batch Status
BatchAPI GetShipmentDetailsForBatchAPI Get /api/v1/shipments/batch/{batchId}/shipments Get Batch Shipment Details
BatchAPI ProcessBatchAPI Post /api/v1/shipments/batch/{batchId}/process Process Batch
BatchAPI VoidShippingLabel Post /api/v1/shipments/batch/{batchId}/void Void Batch Shipping Labels
DefaultsAPI CreateDefaults Post /api/v1/defaults Create Defaults
DefaultsAPI DeleteDefaultsById Delete /api/v1/defaults/{defaultID} Delete Defaults by ID
DefaultsAPI GetAllDefaults Get /api/v1/defaults Get All Defaults
DefaultsAPI GetDefaultsById Get /api/v1/defaults/{defaultID} Get Defaults By ID
DefaultsAPI PutDefaultsById Put /api/v1/defaults/{defaultID} Update Defaults
ManifestAPI CreateManifest Post /api/v1/manifests Create Manifest
ManifestAPI ReprintManifest Post /api/v1/manifests/reprint Reprint manifest
MultipieceAPI MultipieceRates Post /api/v1/multipiece/rates Multipiece Rateshop and Rates
MultipieceAPI MultipieceShipment Post /api/v1/multipiece/shipments Multipiece Shipment
MultipieceAPI MultipieceShipmentCancel Put /api/v1/multipiece/shipments/{shipmentId}/cancel Cancel Multipiece Shipment
MultipieceAPI MultipieceShipmentReprint Get /api/v1/multipiece/shipments/{shipmentId}/reprint Reprint Multipiece Shipment
PickupsAPI CancelPickups Put /api/v1/pickups/cancel Cancel Pickups
PickupsAPI CancelledPickupDocument Post /api/v1/pickups/document Cancelled Pickup Document
PickupsAPI GetPickupDocument Get /api/v1/pickups/{pickupId}/document Get Pickup Document
PickupsAPI GetPickups Get /api/v1/pickups Get Pickups
PickupsAPI SchedulePickup Post /api/v1/pickups Schedule Pickup
PrintAPI DeletePrinterMapping Delete /api/v1/printer/mapping Delete Printer mapping
PrintAPI GetPrinterMapping Get /api/v1/printer/mapping Get Printer mapping
PrintAPI JobStatus Get /api/v1/jobs/{jobId} Job status
PrintAPI PrintDocument Post /api/v1/document/print Print Document
PrintAPI PrinterMapping Post /api/v1/printer/mapping Printer mapping
ShipmentAPI CancelShipmentById Put /api/v1/shipments/{shipmentId}/cancel Cancel Shipment
ShipmentAPI CancelStampsERR Post /api/v1/err/stamps/void Cancel Stamps ERR
ShipmentAPI CreateReturnLabel Post /api/v1/shipments/{shipmentId}/return Create Return label shipment
ShipmentAPI CreateShipment Post /api/v1/shipments Create Shipment
ShipmentAPI DownloadBpodFiles Post /api/v1/err/shipments/bpod Download BPOD Files
ShipmentAPI GetAllShipments Get /api/v1/shipments Get All Shipments
ShipmentAPI GetCarrierAccount Get /api/v1/carrierAccounts Get Carrier Accounts
ShipmentAPI GetCarriers Get /api/v1/carriers Get Carriers
ShipmentAPI GetCountries Get /api/v1/countries Get Countries
ShipmentAPI GetParcelTypes Get /api/v1/parcelTypes Get Parcel Types
ShipmentAPI GetRates Post /api/v1/rates Rate Shop and Get Single Rate
ShipmentAPI GetServices Get /api/v1/services Get Services
ShipmentAPI GetSignatureImageERR Get /api/v1/err/shipments/{shipmentId}/signaturefile Signature Image ERR
ShipmentAPI GetSpecialServices Get /api/v1/specialServices Get Special Services
ShipmentAPI ReprintShipmentById Get /api/v1/shipments/{shipmentId}/reprint Reprint Shipment
ShipmentAPI ShipmentById Get /api/v1/shipments/{shipmentId} Get Shipment by Id
ShipmentByRateShopAPI CancelShipmentByIdV2 Post /api/v2/shipments/cancel Cancel Shipment
ShipmentByRateShopAPI CreateShipmentV2 Post /api/v2/shipments Create Shipment
ShipmentByRateShopAPI ReprintShipmentByIdV2 Post /api/v2/shipments/reprint Reprint Shipment

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), shipping.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

Usage

To call a specific operation, refer to the details below

Syntax

_, response, error := client.Service.Operation(auth, args).Execute()

Example

shippingCfg := shipping.NewConfiguration()
shippingApiClient := shipping.NewAPIClient(shippingCfg)

SERVER_INDEX := 1 (or 0) // 0=sandbox (default), 1=production
auth := context.WithValue(context.Background(), shipping.ContextServerIndex, SERVER_INDEX)
auth = context.WithValue(auth, shipping.ContextAccessToken, "BEARER_TOKEN_STRING")

_, response, error := shippingApiClient.ShipmentAPI.GetAllShipments(auth).Execute()

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

PitneyBowes API 360 shipping SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages