Antes de começar

Como gerar o token para autenticação?

Para utilizar as APIs da Maplink, é necessário gerar um bearer token a partir das suas credenciais únicas.

Cada bearer token tem a duração de 60 minutos e poderá ser usado por qualquer API. Após este intervalo será necessário gerar um novo token.

Abaixo um exemplo de credenciais únicas que devem ser usadas em body na geração do bearer token:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
client_id: 0wf*************************eqFG
client_secret: 1b***********owE
client_id: 0wf*************************eqFG client_secret: 1b***********owE
client_id: 0wf*************************eqFG
client_secret: 1b***********owE

Com o client_id e client_secret, utilizar o seguinte endpoint com o método POST para obter o bearer token:

https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials

Exemplo da request

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
curl -X POST "https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials" -H
"Content-Type: application/x-www-form-urlencoded" --data-urlencode "client_id=0wf*************************eqFG" --data-urlencode "client_secret=1b***********owE"
curl -X POST "https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "client_id=0wf*************************eqFG" --data-urlencode "client_secret=1b***********owE"
curl -X POST "https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials" -H

"Content-Type: application/x-www-form-urlencoded" --data-urlencode "client_id=0wf*************************eqFG" --data-urlencode "client_secret=1b***********owE"

Exemplo da response

O “access_token” : “XBlgpdua80eonaU7FmRjhRsjMe3c” é o que deverá ser usado para autenticar as requisições das outras APIs por 60 minutos.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
{
"refresh_token_expires_in": "0",
"api_product_list": "[Matrix, Restriction Zone, Trip, Planning, Toll, Place, Geocode, Toll Search]",
"api_product_list_json": [
"Matrix",
"Trip",
"Planning",
"Toll",
"Geocode" ],
"organization_name": "lbslocal",
"developer.email": "abcde@abcde.com",
"token_type": "BearerToken",
"issued_at": "1620249207151",
"client_id": "0wf*************************eqFG",
"access_token": "XBlgpdua80eonaU7FmRjhRsjMe3c",
"application_name": "49136471-81b0-4f23-bfff-980f0337f01e",
"scope": "",
"expires_in": "3599",
"refresh_count": "0",
"status": "approved"
}
{ "refresh_token_expires_in": "0", "api_product_list": "[Matrix, Restriction Zone, Trip, Planning, Toll, Place, Geocode, Toll Search]", "api_product_list_json": [ "Matrix", "Trip", "Planning", "Toll", "Geocode" ], "organization_name": "lbslocal", "developer.email": "abcde@abcde.com", "token_type": "BearerToken", "issued_at": "1620249207151", "client_id": "0wf*************************eqFG", "access_token": "XBlgpdua80eonaU7FmRjhRsjMe3c", "application_name": "49136471-81b0-4f23-bfff-980f0337f01e", "scope": "", "expires_in": "3599", "refresh_count": "0", "status": "approved" }
{
    "refresh_token_expires_in": "0",
    "api_product_list": "[Matrix, Restriction Zone, Trip, Planning, Toll, Place, Geocode, Toll Search]",
    "api_product_list_json": [
        "Matrix",
        "Trip",
        "Planning",
        "Toll",
        "Geocode"    ],
    "organization_name": "lbslocal",
    "developer.email": "abcde@abcde.com",
    "token_type": "BearerToken",
    "issued_at": "1620249207151",
    "client_id": "0wf*************************eqFG",
    "access_token": "XBlgpdua80eonaU7FmRjhRsjMe3c",
    "application_name": "49136471-81b0-4f23-bfff-980f0337f01e",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"
}