Sorry, you need to enable JavaScript to visit this website.

You are here

Getting Started with our APIs

BY Michelle Telstra 07 July 2020

Getting Started with our APIs

In this blog, we are going to discuss the things you need to know first on how to use the Telstra API. We will show you how to generate the Authentication token, how to retrieve the API client key and secret, etc.

 

Objectives

 

This tutorial aims to help you with:

 

  • Set up your TelstraDev API environment
  • Obtaining Client key and Client Secret
  • Generate Access Token

 

Setting up TelstraDev API environment in Postman

 

Postman is an API client that makes it easy for developers to create, test and document APIs. You can download Postman here.

 

After Postman was successfully installed, we can now import the collection to Postman by copying and pasting this link:

https://app.getpostman.com/api/collections/44f2a97ae4c9689ce53e

 

There we have it. API endpoints are now listed in the sidebar. Before we proceed with generating our access token, let’s create an environment first.  

Steps in creating a Postman environment:

  1. Click the environment options (Gear Icon)   and select manage environments.
  1. Click Add.
  1. Name your environment. In this tutorial, just name it Telstra.
  1. Under the key field, type “host” and “tapi.telstra.com” as the value. 
  1. Save the environment by clicking Add.

 

 

Obtaining Client Key and Secret

 

Client Key is the public Identifier for your application. On the other hand, Client Secret is the secret key known only to the application and authorization server.

 

Client key and client secret are essential to access the API. Here are the steps you need to follow in order to acquire your API client key and client secret.

 

  1. Log in to Telstra dev portal. https://dev.telstra.com. If you don't have an account, you can register for free.

 

  1. Once you have logged in to TelstraDev Portal, select the Develop in Menu, and then select My apps & keys.

 

  1. By default, the Free Trial APIs app is already created on your account. You can use the default API Client Key and Secret that comes with this app or you can also create your own app. To find out which APIs are accessible with a free account, check out our pricing and plans page https://dev.telstra.com/pricing-plan.

 

Please take note that you don’t necessarily need to create multiple apps. However, if you want to track your API usage for different TelstraDev API (Messaging, Connected Thing, etc), creating multiple apps will help you as it will track the API usage per application.

 

  1. Click the drop-down arrow on the application, then click on the key tab. Your Client Key and Client secret will now be shown. Do not share your Client Key or Secret to anyone.

 

  1. Client key and Client secret are required parameter in OAuth2 authentication. You can refer to this link for more information on OAuth2 authentication https://oauth.net/2/

 

  1. Once the client key and secret are secured, you can now access our APIs.

 

 

Generate Access Token

 

The access token is used in token-based authentication to allow an application to access an API. The application receives an Access Token after a user successfully authenticates and authorizes access, then passes the Access Token as a credential when it calls the target API. The passed token informs the API that the bearer of the token has been authorized to access the API and perform specific actions specified by the scope that was granted during authorization.

 

TelstraDev API uses OAuth2 for its authentication. OAuth2 is the preferred method of authenticating access to the API. OAuth2 allows authorization without the external application getting the user's email address or password. Instead, the external application gets a token that authorizes access to the user's account. The user can revoke the token for one application without affecting access by any other application.

 

Here are the steps in Generating Access Token using OAuth2 in TelstraDev API.

 

Browse your collection and under OAuth folder select “Generate OAuth token” and it will open a new tab. To generate an access token, we will be passing four parameters. You can find your client_id and client_secret via My Apps & Keys.

 

client_id:          //your client ID *required

client_secret:   //your client secret *required

grant_type:     client_credentials *required

scope:              NSMS

 

 

 

 

Here’s a sample body for requesting an access token.

 

Once you have provided the correct values for each parameter, click send.  You will get the response containing your access token. Note that the token is valid for an hour. 

 

 

 

Notice under your environment settings, the access token was added automatically.

 

If you have further questions, please email us at telstradev@team.telstra.com.

By Michelle.idv


10/4/20

  • iot
  • captis

Capture more insights with our...

Calling all IoT makers and innovators, there’s a new device on our

By Michelle.idv


10/4/20

  • hackathon
  • innovation

Telstra Innovation Hackathon...

Calling all startups, Telstra partners and GCC employees; Registrations are now open for Telstra&

By Michelle.idv


10/4/20

  • iot
  • nbiot

What's the Difference...

Here’s what our previous CFO said which is good:

By Michelle.idv


10/4/20

  • iot
  • platform

Telstra's IoT Platform

The Internet

By Michelle.idv


10/4/20

  • iot
  • developer

Wireless Application Developers...

The Internet of Things (IoT) is an all-encompassing suite of technologies, with dozens of options

By Michelle


2/4/20

  • Messaging API
  • Tutorials

Get Started with the TelstraDev...

Have you ever wondered what an API is and why you should care?

By Michelle.idv


10/4/20

  • Announcement
  • Community

New Developer Feature: API...

You asked, we listened.

By Michelle.idv


10/4/20

  • Developers
  • Community

Virtual Greetings and Updates

Hello World!

By praveen.kumar


8/3/18

  • arduino
  • mkr

Introducing the Arduino MKR...

Last year we were proud to announce our partnership with Arduino to help create an (read more abo

By admin


18/5/16

  • callbacks
  • Messaging SDK

Understanding Messaging API...

Welcome to the second in a two part series on understanding the messaging API callbacks.

By admin


18/5/16

  • callback
  • postman

Understanding Messaging API...

The callback functionality of the messaging API is a great utility allowing you to track the deli

By admin


18/5/16

  • 2018
  • New Year

Welcoming in the New Year

Happy New year, I hope you had an awesome break and was able to recharge, reset and prepare for t