Type to search...

Access token: create

Request

HTTP request

POST /secure/v1/access-token HTTP/1.1

Parameters

This method does not support path parameters.

Request Body

Property name Value Description
Required properties
type string Type of the access token
expiry integer Expiration time of the access token
limit integer Usage limitation of the access token
Optional properties
extra object Additional extras for the access token

Response

If successful, this method returns a access token resource in the response body.

Response HTTP status code

HTTP status code Description
200 Success

For more information about HTTP codes, click here.

Rate limit

Detailed information for access token rate limitation is available on Shardimage developers.

SDK

use shardimage\shardimagephp\auth\Client;
use shardimage\shardimagephp\models\accesstoken\ImageUrlAccessToken;
 
$client = new Client([
    'apiKey' => '<apiKey>',
    'apiSecret' => '<apiSecret>',
    'imageSecret' => '<imageSecret>',
]);
 
$token = new ImageUrlAccessToken();   // Type is already configured
$token->expiry = time() + 3600;       // Alive for 1 hour
$token->limit = 1000;                 // Can be used for 1000 times
 
$result = $client->getAccessTokenService()->create($token);
Table of contents