Get started using Postman Collections for Plivo Phone Numbers API

    Overview

    Plivo APIs are packaged and ready to use with Postman, an API testing tool that helps developers set up, test, and explore APIs. Plivo’s Postman collection includes APIs for our SMS, Voice, Phone Numbers, Account, Lookup, and PHLO products, along with documentation for each API to help you learn about them.

    We’ve created a ready-to-use set of the applicable APIs so you don’t have to manually add endpoints that you’d like to use inside Postman. Each endpoint comprises all the available parameters and the necessary authentication process, along with example responses, so you only need to declare your credentials and parameter values globally to start exploring the features. Let’s walk through the process.

    Install Postman and download the Postman collection

    First, download and install Postman. You also need a Plivo account; if you don’t have one yet, sign up now. Next, click on the below button

    A window will appear asking if you want the collection to be added to your local Postman app or if you want to use a web app.

    You’ll see the collection in your chosen space based on the options you’ve chosen.

    Add Keys and Tokens

    Now you can add your keys and tokens to your Postman collection. Open Postman from Applications under macOS or your desktop on Windows. The first thing you need to do is add your authentication credentials.

    • Click on the collection Plivo REST API.

    Edit Details

    • Select Authorization, then, from the drop-down list, set the Type as Basic Auth.

    Set Authorization

    • For Username and Password, fill in your Plivo Auth ID and Auth Token respectively, which you can find on the overview page of the console.

    You’ve now authenticated Postman to your Plivo account. The next step is to make that authentication available for every endpoint.

    Set up environment variables

    Set up the auth_id as an environment variable, so you can use it in every endpoint you have.

    • Click on the collection Plivo REST API.

      Edit Details

    • Click on Variables. Declare the variable auth_id, and provide the initial and current value as the Auth ID from the console.

      Set Variables

    • Once you’ve done that, you can access your Auth ID by writing {{auth_id}} within your Postman collection. We’ve already done that for you for all the APIs in the Plivo collection.

    Now we’re ready to test some APIs!!

    Example: Buy Phone Numbers

    To see how Plivo and Postman work together, let’s start by searching for an available phone number. From the imported Plivo REST API collection, select the folder named Phone Numbers followed by Search/Buy a Phone Number, and select the request named Buy a Phone Number.

    You can find a number by using the Search Phone numbers API, which is right above the Buy a Phone number API request in your collection, or from the console. Update the URL with the number you wish to purchase — it should look like

    https://api.plivo.com/v1/Account/{{auth_id}}/PhoneNumber/14153234567/
    

    Under Body, replace app_id with the application you want to attach, if you have one.

    Buy a Phone number

    To learn more about optional and required parameters, either refer to the documentation available within the Postman collection or visit our Phone number API reference guide.

    Document

    You can also find an example API response and status code for each API directly beneath the API tab, as in this example:

    Successful example

    Postman helps us keep all of our APIs organized, categorized, and always ready to use with just a few modifications depending on our needs. It helps us not only with triggering API requests but also with testing APIs. Overall, Postman makes it easier for developers to test and integrate their systems with Plivo.