All URIs are relative to https://tapi.telstra.com/v2
Method | HTTP request | Description |
---|---|---|
authToken | POST /oauth/token | Generate OAuth2 token |
\Telstra_Messaging\Model\OAuthResponse authToken($client_id, $client_secret, $grant_type)
Generate OAuth2 token
To generate an OAuth2 Authentication token, pass through your Client key
and Client secret
that you received when you registered for the API Free Trial Product. The grant_type should be left as client_credentials
and the scope as NSMS
. The token will expire in one hour.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$client_id = 'client_id_example'; // string |
$client_secret = 'client_secret_example'; // string |
$grant_type = 'client_credentials'; // string |
try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->authToken: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
client_id | string | ||
client_secret | string | ||
grant_type | string | [default to 'client_credentials'] |
\Telstra_Messaging\Model\OAuthResponse
No authorization required
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]