Data and Software APIs

Generating SDKs Using LI API Swagger Specification

  • 1.  Generating SDKs Using LI API Swagger Specification

    Posted 05-27-2019 05:45
    Edited by Harpreet Singh Seehra 05-28-2019 01:11

     

    This article explains how to create client SDKs using LI API Swagger Specification.

    Generating SDKs using Swagger Editor

    1. Copy LI API Swagger Specification from https://locate.pitneybowes.com/downloads/location-intelligence/v1/LocationIntelligenceApi_Swagger.json
    2. Paste the specification in Swagger Editor at https://editor.swagger.io/
    3. The editor will validate and show the LI APIs.
    4. Click on Generate Client link on the title bar in Swagger Editor and select any desired platform/Language to generate SDK.

    The zipped SDK will be downloaded, which also contains a README file. Follow the README file to build the library.

    Generating and Setting the OAuth Token

    Curl request to generate OAuth token is:

    curl -X POST https://api.pitneybowes.com/oauth/token -H "Authorization: Basic {base64Value}" -H "Content-Type: application/x-www-form-urlencoded" -d grant_type=client_credentials

    For more details on generating and using OAuth token, see article Using OAuth to access Locate APIs

    To set the token, read the README file from the downloaded SDK and follow the sample code example.

    Refreshing the Token

    Access token have limited lifetime. If the token expires, follow Step 4 in the article Using OAuth to access Locate APIs