Before a 3rd Party Application can access the NetSapiens API, it must obtain an access token via the OAuth2 standard.
As a Landstar Telecom subscriber, you should use the Portal & API node assigned to your account.
The Branded Manager portal is at https://portal.landstartel.co, your API base URL will be https://portal.landstartel.co/ns-api/.
Access Token Privileges
The username and password used to access the api can be any valid Subscriber username and password that can log into the Manager portals. The scope of the Subscriber will determine what access your token will be granted.
| Scope |
Access Level |
| Basic User |
Read and Modify any data related to the Subscriber |
| Office Manager |
Read and Modify any data related to the Subscriber’s Domain |
| |
|
Client ID and Client Secret
A Client ID and Secret along with the username and password of a Subscriber will be required to retrieve an access token. Please request a Client ID and Secret from Support if you currently do not have a Client ID and Secret.
Request for Access Token
curl https://portal.landstartel.co/ns-api/oauth2/token/ \ -dclient_id=your-client-id \ -dclient_secret=your-client-secret \ -dusername=111@abc-company \ -dpassword=1234 \ -dgrant_type=password
Returned Access Token
{
“access_token”:“90679e87dc2e6409211e822434122aaf9480”,
“expires_in”:3600,
“scope”:“Office Manager”,
“token_type”:“Bearer”,
“refresh_token”:“c7bf58a0247e02efc6ee4340f01ed629”,
“legacy”: false,
“domain”: “abc-company.12345.service”,
“apiversion”:
“Version: 41.1.0”
}
Using the Access Token
Once an Access Token is acquired, each additional request needs to contain this token in the Authorization header as follows:
Authorization: Bearer 90679e87dc2e6409211e822434122aaf9480
Refreshing a Token
An expiring token can be refreshed to get a new access token without the need for the username and password to be resubmitted.
Request for Token Refresh
curl–location –request GET ‘https://portal.landstartel.co/ns-api/oauth2/token/?grant_type=refresh_token&client_id=your-client-id&client_secret=your-client-secret&refresh_token=c7bf58a0247e02efc6ee4340f01ed629’
Returned New Access Token
{
“access_token”: “3b9d3229d70b442e99e0dfa050473d63”,
“expires_in”: 3600,
“scope”: “Office Manager”,
“token_type”: “Bearer”,
“refresh_token”: “c7bf58a0247e02efc6ee4340f01ed629”,
“legacy”: false,
“domain”: “abc-company.12345.service”,
“apiversion”: “Version: 41.1.0”
}
Use the new token in the Authorization header of succeeding requests.
Authorization: Bearer 3b9d3229d70b442e99e0dfa050473d63
Inspecting an Access Token
An access token can be expected to learn more information about the token. It can be used to retrieve the territory (Reseller ID), domain and the expiration among other information.
Inspecting an Access Token
curl –location –request GET ‘https://portal.landstartel.co/ns-api/oauth2/read?format=json’ \ –header ‘Authorization: Bearer 3b9d3229d70b442e99e0dfa050473d63’
Access Token Information
{
“token”: “3b9d3229d70b442e99e0dfa050473d63”,
“client_id”: “your-client-id”,
“territory”: “12345”,
“domain”: “abc-company.12345.service”,
“uid”: “111@abc-company.12345.service”,
“expires”: “2020-06-11 21:04:14”,
“scope”: “Office Manager”,
“apiversion”: “Version: 41.1.0”
}