ShippingAPI
ShippingApi - JavaScript client for ShippingAPI Shipping API Sample. This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
Node.js
Fornpm
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your ShippingAPI from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var ShippingApi = require('ShippingAPI');
var defaultClient = ShippingApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: oAuth2ClientCredentials
var oAuth2ClientCredentials = defaultClient.authentications['oAuth2ClientCredentials'];
oAuth2ClientCredentials.accessToken = "YOUR ACCESS TOKEN"
var api = new ShippingApi.AddressValidationApi()
var address = new ShippingApi.Address(); // {Address} Address object that needs to be validated.
var opts = {
'xPBUnifiedErrorStructure': true, // {Boolean} 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.
'minimalAddressValidation': true // {Boolean} 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.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.verifyAddress(address, opts, callback);
Documentation for API Endpoints
All URIs are relative to https://api-sandbox.pitneybowes.com/shippingservices
Class | Method | HTTP request | Description |
---|---|---|---|
ShippingApi.AddressValidationApi | verifyAddress | POST /v1/addresses/verify | Address validation |
ShippingApi.AddressValidationApi | verifyAndSuggestAddress | POST /v1/addresses/verify-suggest | Address Suggestion |
ShippingApi.CarrierInfoApi | getCarrierFacilities | POST /v1/carrier-facility | Find Carrier Facilities |
ShippingApi.CarrierInfoApi | getCarrierLicenseAgreement | GET /v1/carrier/license-agreements | This operation retrieves a carrier's license agreement. |
ShippingApi.CarrierInfoApi | getCarrierServiceRules | GET /v1/information/rules/rating-services | Retrieves the rules governing the carrier's services. |
ShippingApi.CarrierInfoApi | getCarrierSupportedDestination | GET /v1/countries | This operation returns a list of supported destination countries to which the carrier offers international shipping services. |
ShippingApi.ContainerApi | getContainerizedParcelsLabels | POST /v1/container-manifest | Create Container Manifest Label |
ShippingApi.CrossBorderQuotesApi | getCrossBorderQuotes | POST /v1/crossborder/checkout/quotes | Cross-Border Quotes |
ShippingApi.CrossBorderQuotesApi | predictedHSCode | POST /v1/crossborder/hs-classification/items | Predicts the HS Code for a parcel |
ShippingApi.ManifestsApi | createManifest | POST /v1/manifests | This operation creates an end-of-day manifest |
ShippingApi.ManifestsApi | reprintManifest | GET /v1/manifests/{manifestId} | reprintManifest |
ShippingApi.ManifestsApi | retryManifest | GET /v1/manifests | retryManifest |
ShippingApi.ParcelProtectionApi | cancelParcelProtection | POST /v1/parcel-protection/void | Parcel Protection Coverage |
ShippingApi.ParcelProtectionApi | getParcelProtectionCoverage | POST /v1/parcel-protection/create | Parcel Protection Coverage |
ShippingApi.ParcelProtectionApi | getParcelProtectionQuote | POST /v1/parcel-protection/quote | Parcel Protection Quote |
ShippingApi.ParcelProtectionApi | getParcelProtectionReports | GET /v1/parcel-protection/{developerId}/policies | Parcel Protection Reports |
ShippingApi.PickupApi | cancelPickup | POST /v1/pickups/{pickupId}/cancel | Cancel Pickup |
ShippingApi.PickupApi | getPickupschedule | POST /v1/pickups/schedule | Address validation |
ShippingApi.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. |
ShippingApi.ShipmentApi | cancelShipment | DELETE /v1/shipments/{shipmentId} | cancelShipment |
ShippingApi.ShipmentApi | createShipmentLabel | POST /v1/shipments | This operation creates a shipment and purchases a shipment label. |
ShippingApi.ShipmentApi | reprintShipment | GET /v1/shipments/{shipmentId} | reprintShipment |
ShippingApi.ShipmentApi | retryShipment | GET /v1/shipments | retryShipment |
ShippingApi.TrackingApi | addTrackingEvents | POST /v2/track/events | getTrackingDetails |
ShippingApi.TrackingApi | getTrackingDetails | GET /v1/tracking/{trackingNumber} | getTrackingDetails |
ShippingApi.TransactionReportsApi | getTransactionReport | GET /v4/ledger/developers/{developerId}/transactions/reports | This operation retrieves all transactions for a specified period of time. |
Documentation for Models
- ShippingApi.AddTrackingEvents
- ShippingApi.AddTrackingEventsEvents
- ShippingApi.AddTrackingEventsReferences
- ShippingApi.AdditionalAddress
- ShippingApi.Address
- ShippingApi.AddressSuggestionResponse
- ShippingApi.AddressSuggestionResponseSuggestions
- ShippingApi.AddressVerifySuggest
- ShippingApi.BatteryDetails
- ShippingApi.CancelShipment
- ShippingApi.Carrier
- ShippingApi.CarrierFacilityRequest
- ShippingApi.CarrierFacilityRequestAddress
- ShippingApi.CarrierFacilityResponse
- ShippingApi.CarrierFacilityResponseCarrierFacilityOptions
- ShippingApi.CarrierFacilityResponseCarrierFacilitySuggestions
- ShippingApi.CarrierFacilityResponseFacilityHours
- ShippingApi.CarrierFacilityResponseFacilityTimings
- ShippingApi.CarrierPayment
- ShippingApi.CarrierRule
- ShippingApi.CommodityInfo
- ShippingApi.ContainerDetails
- ShippingApi.ContainerManifestResponse
- ShippingApi.ContainerManifestResponseData
- ShippingApi.CrossBorderQuotesErrors
- ShippingApi.CrossBorderQuotesErrorsErrors
- ShippingApi.CrossBorderQuotesErrorsErrorsErrors
- ShippingApi.CrossBorderQuotesErrorsQuote
- ShippingApi.CrossBorderQuotesErrorsQuoteLines
- ShippingApi.CrossBorderQuotesErrorsUnitErrors
- ShippingApi.CrossBorderQuotesRequest
- ShippingApi.CrossBorderQuotesRequestAttributes
- ShippingApi.CrossBorderQuotesRequestBasketItems
- ShippingApi.CrossBorderQuotesRequestCategories
- ShippingApi.CrossBorderQuotesRequestDescriptions
- ShippingApi.CrossBorderQuotesRequestIdentifiers
- ShippingApi.CrossBorderQuotesRequestItemDimension
- ShippingApi.CrossBorderQuotesRequestPricing
- ShippingApi.CrossBorderQuotesRequestPricingCodPrice
- ShippingApi.CrossBorderQuotesRequestRates
- ShippingApi.CrossBorderQuotesRequestUnitWeight
- ShippingApi.CrossBorderQuotesResponse
- ShippingApi.CrossBorderQuotesResponseLineRates
- ShippingApi.CrossBorderQuotesResponseQuote
- ShippingApi.CrossBorderQuotesResponseQuoteLines
- ShippingApi.CrossBorderQuotesResponseTotalRates
- ShippingApi.CrossBorderQuotesResponseUnitRates
- ShippingApi.CrossBorderQuotesResponseUnitRatesDeliveryCommitment
- ShippingApi.Customs
- ShippingApi.CustomsInfo
- ShippingApi.CustomsItem
- ShippingApi.DeliveryCommitment
- ShippingApi.DimensionRules
- ShippingApi.DimensionRulesMaxParcelDimensions
- ShippingApi.DimensionRulesMinParcelDimensions
- ShippingApi.Discount
- ShippingApi.DocTabItem
- ShippingApi.Document
- ShippingApi.DocumentPage
- ShippingApi.Errors
- ShippingApi.HazmatDetails
- ShippingApi.ISOCountryCode
- ShippingApi.InfectiousSubstanceContact
- ShippingApi.InlineResponse200
- ShippingApi.InlineResponse2001
- ShippingApi.InlineResponse2002
- ShippingApi.Manifest
- ShippingApi.PageRealTransactionDetailReport
- ShippingApi.Parameter
- ShippingApi.Parcel
- ShippingApi.ParcelDimension
- ShippingApi.ParcelProtectionCreateRequest
- ShippingApi.ParcelProtectionCreateRequestShipmentInfo
- ShippingApi.ParcelProtectionCreateRequestShipmentInfoConsigneeInfo
- ShippingApi.ParcelProtectionCreateRequestShipmentInfoParcelInfo
- ShippingApi.ParcelProtectionCreateRequestShipmentInfoParcelInfoCommodityList
- ShippingApi.ParcelProtectionCreateRequestShipmentInfoShipperInfo
- ShippingApi.ParcelProtectionCreateRequestShipmentInfoShipperInfoAddress
- ShippingApi.ParcelProtectionCreateResponse
- ShippingApi.ParcelProtectionCreateResponseParcelProtectionFeesBreakup
- ShippingApi.ParcelProtectionPolicyResponse
- ShippingApi.ParcelProtectionPolicyResponseContent
- ShippingApi.ParcelProtectionPolicyResponsePolicyDetails
- ShippingApi.ParcelProtectionPolicyResponseShipmentDetails
- ShippingApi.ParcelProtectionPolicyResponseShipperInfo
- ShippingApi.ParcelProtectionPolicyResponseShipperInfoAddress
- ShippingApi.ParcelProtectionPolicyResponseSort
- ShippingApi.ParcelProtectionQuoteRequest
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfo
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfoConsigneeInfo
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfoParcelInfo
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfoParcelInfoCommodityList
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfoShipperInfo
- ShippingApi.ParcelProtectionQuoteRequestShipmentInfoShipperInfoAddress
- ShippingApi.ParcelProtectionQuoteResponse
- ShippingApi.ParcelProtectionQuoteResponseParcelProtectionFeesBreakup
- ShippingApi.ParcelType
- ShippingApi.ParcelTypeRules
- ShippingApi.ParcelWeight
- ShippingApi.PrerequisiteRules
- ShippingApi.RadioActiveParcelDimension
- ShippingApi.RadioActivityDetail
- ShippingApi.RadioNuclideDetail
- ShippingApi.Rate
- ShippingApi.RealTransactionDetailReport
- ShippingApi.SchedulePickup
- ShippingApi.SchedulePickupPickupSummary
- ShippingApi.SchedulePickupResponse
- ShippingApi.SchedulePickupTotalWeight
- ShippingApi.SearchCriteria
- ShippingApi.Services
- ShippingApi.ServicesParameterRule
- ShippingApi.Shipment
- ShippingApi.Signatory
- ShippingApi.SpecialService
- ShippingApi.SpecialServiceCodes
- ShippingApi.SpecialServicesRule
- ShippingApi.Surcharge
- ShippingApi.Tax
- ShippingApi.Trackable
- ShippingApi.TrackingAddress
- ShippingApi.TrackingResponse
- ShippingApi.TrackingResponseScanDetailsList
- ShippingApi.UnitOfDimension
- ShippingApi.UnitOfWeight
- ShippingApi.VoidParcelProtectionRequest
- ShippingApi.VoidParcelProtectionResponse
- ShippingApi.WeightRules
Documentation for Authorization
oAuth2ClientCredentials
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: N/A