Docs

Using Postman To Get Started With APICO API

This article is aimed at developers who are not yet familiar with APIFONICA REST API and want to build it into their applications quickly and easily.

Postman is a Google Chrome extension with a friendly interface that helps developers be more efficient when working with REST based calls. It’s free and available for the most common operating systems.

Postman lets you try and test APIFONICA API in just a minute. We took the requests that could be made against APIFONICA API and saved them as Postman collection. With this tool, you can find out how to acquire a phone number or enable your application to communicate before you even touch a line of code.

STEP 1

Download the POSTman REST Client at the following URL https://www.getpostman.com/ and install it.

STEP 2

Import the APIFONICA API collection.

To do this:

  1. Launch Postman.

  2. On the toolbar, click Import.

    postman1.jpg

  1. In the Import window at opens, click the From URL tab and paste the following link http://www.apifonica.com/postman-apico-api.php

postman2_2.jpg

  1. Click Import.

            The APIFONICA API collection appears on the Collections tab.

              postman3_1.jpg

STEP 3

Create a new environment—this helps you to store a set of parameter / value pairs and customize requests according to this data.

To do this:

            The APIFONICA environment is created.

  1. Click the arrow next to the environment selector link and select Manage environments in the dropdown menu.

    postman4_3.jpg

  2. In the window that opens, click Add.

  3. Enter the name for the new environment, for example APIFONICA.

  4. Add four keys with the following names: token, subscriber_id, app_id and number.

    postman5_1.jpg

  5. Click Submit.

              The APIFONICA environment is created.

  1. Select the newly created APIFONICA environment using the environment selector link.

              The APIFONICA environment is ready to use.

       postman6_1.jpg

STEP 4

Become a registered APIFONICA.net subscriber.

If you are not yet registered to APIFONICA, click here to create your account. It’s quick and free!

STEP 5

Authorize to APIFONICA—you need a valid access token to gain access to the API.

Important! The access token is valid for 24 hours.

To do this:

  1. In POSTman, expand the APIFONICA API Public collection, then click the Authorization folder.

  2. Construct the POST /login request using the following credentials:

    • Your login to the personal account on the apifonica.com web site as client_id.

    • Your password to the personal account on the apifonica.com web site as client_secret.

    • Leave the grant_type key with the client_credentials value.

               postman8_2.jpg

  1. Click Send and receive an access token in the response.

              postman10_1.jpg

Note You can also gain access to APIFONICA API from within a registered application or by using the login/password of the phone number. For more details, refer to APIFONICA API Access Rights.

STEP 6

Assign values to essential parameters in the APIFONICA environment—Postman will replace them with the assigned values when sending requests.

To specify access token value:

  • In the POST /login response, double-click the access_token value to open a context menu and select Set: APIFONICA, then token.

    postman9_1.jpg

The selected value will now replace the {{token}} variable in all other requests to APIFONICA.

To specify subscriber identifier value:

  • In the POST /login response, double-click the id value to open a context menu and select Set: APIFONICA, then subscriber_id.

The selected value will now replace the {{subscriber_id}} variable in all other requests to APIFONICA.

Values of application identifier(s) and phone number identifier(s) can be found in your personal account on the apifonica.com web site. You can assign them directly or retrieve them by using the APIFONICA API requests.

STEP 7

Start making HTTP calls to APIFONICA services—construct POST, GET, PUT and DELETE requests from the APIFONICA collection by using the parameter values saved in the APIFONICA environment or by specifying parameters and values explicitly.

 

postman11_2.jpg

See also: