O End-Point tem por objetivo fornecer serviços referente à entidade Orgão do serviço da SGP do portal da Assembleia Legislativa do Estado de Mato Grosso.

Para se autenticar no end-point você deverá informar as credenciais (fornecidas pela instituição) para a obtenção de um token de acesso, que deverá ser informado no cabeçalho das requisições deste serviço.

Para obter o token de acesso, utilizando o grant_type denominado password você precisa realizar uma requisição semelhante à esta:

curl -X POST
/oauth/v2/token
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-d 'grant_type=password&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]'
POST /oauth/v2/token HTTP/1.1
Host: api.al.mt.gov.br
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

grant_type=password&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.al.mt.gov.br/oauth/v2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=password&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://api.al.mt.gov.br/oauth/v2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Para obter o token de acesso, utilizando o grant_type denominado http://al.mt.gov.br/grants/password_and_totp você precisa realizar uma requisição semelhante à esta:

curl -X POST
/oauth/v2/token
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-d 'grant_type=http://al.mt.gov.br/grants/password_and_totp&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]'
POST /oauth/v2/token HTTP/1.1
Host: api.al.mt.gov.br
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

grant_type=http://al.mt.gov.br/grants/password_and_totp&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.al.mt.gov.br/oauth/v2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=http://al.mt.gov.br/grants/password_and_totp&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://api.al.mt.gov.br/oauth/v2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=http://al.mt.gov.br/grants/password_and_totp&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Para a geração do totp_pin o autenticador deverá respeitar as seguintes características:

  • Algoritmo SHA-1 Digest
  • PIN atualizado a cada 30 segundos
  • PIN de 6 dígitos
  • RFC 6238

Recomendamos a ferramenta Google Authenticator para a geração do PIN.

Para obter o token de acesso, utilizando o grant_type denominado http://al.mt.gov.br/grants/password_and_totp_and_uuid você precisa realizar uma requisição semelhante à esta:

curl -X POST
/oauth/v2/token
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-d 'grant_type=http://al.mt.gov.br/grants/password_and_totp_and_uuid&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]&uuid=[uuid]'
POST /oauth/v2/token HTTP/1.1
Host: api.al.mt.gov.br
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

grant_type=http://al.mt.gov.br/grants/password_and_totp_and_uuid&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]&uuid=[uuid]
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.al.mt.gov.br/oauth/v2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=http://al.mt.gov.br/grants/password_and_totp_and_uuid&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]&uuid=[uuid]",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://api.al.mt.gov.br/oauth/v2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=http://al.mt.gov.br/grants/password_and_totp_and_uuid&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]&totp_pin=[totp_pin]&uuid=[uuid]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Para a geração do uuid você deverá respeitar as seguintes características:

Observação: As validações acima foram derrubadas, buscando compatibilidade com o UDID.

O token de acesso será retornado em uma resposta semelhante à esta:

{
    "access_token": "OTlkMjZmMWM4NDljYzA5NzYxNDA3MTg4NGQxNWFlNWYxZjJkMjA3MDFkYzZhMTRiMjE1ZjRlNzBmMDEwMjg4Nw",
    "expires_in": 3600,
    "token_type": "bearer",
    "scope": null,
    "refresh_token": "ZThkOGNhZWVlOGIyNTJjYzg1MjQwZGQzNjFhOWIxYmFjZjE4MDM3MDhmNzgxZTZhN2U5ZDM5Yjk5ZTVkMWM1ZQ"
}

O atributo expires_in representa o tempo em segundos de validade do access_token .

Para utilizar o end-point você deverá adicionar um cabeçalho semelhante a este:

Authorization: [token_type (a primeira letra deve ser maíuscula)] [access_token]

Observação: As chamadas devem ser síncronas, as chamadas assíncronas serão rejeitadas pelo servidor, por motivos de segurança.

Para o end-point /api/v1/gdprev/orgao/

{
    "entities": [
        {
            "1": ""
        },
        {
            "1": ""
        },
        {
            "1": ""
        }
    ]
}

A estrutura de retorno pode ser modificada de acordo com a estrutura do registro a ser entregue, podendo, então, ocasionar modificações na estrutura de exemplo acima apresentada.

Para o end-point /api/v1/gdprev/orgao/1

{
    "1": ""
}

A estrutura de retorno pode ser modificada de acordo com a estrutura do registro a ser entregue, podendo, então, ocasionar modificações na estrutura de exemplo acima apresentada.