Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

POST      /api/broker/estabelecimento/login

...

Campos

Tipo

Descrição

Obrigatório

UserName

String

Nome do Usuário

Sim

Password

String

Senha para Acesso

Sim

 

JSON:

Code Block
{

...


    "UserName":

...

 "TesteBroker",
    "Password":

...

 "123456"
}

Response Body    application/json

...

Campo

Tipo

Descrição

created

Long

Data em formato Unix Epoch da criação do Token (Segundos desde 01/01/1970)

expires_In

Long

Tempo em segundos para a expiração do Token

access_Token

String

Bearer Token

userId

Guid

ID que identifica o usuario que gerou o Token

token_Type

String

Tipo do Token (Bearer)

 

Segue abaixo exemplo de autenticação na API utilizando Postman:

C#JSON:

Code Block
var client = new RestClient("https://localhost:44380/api/broker/estabelecimento/login");

var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");

request.AddParameter("application/json", "{\n\t\"UserName\" : \"caio.fontes\",\n\t\"Password\": \"123456\"\n}",  ParameterType.RequestBody);

IRestResponse response = client.Execute(request);

Console.WriteLine(response.Content);

PHP

Code Block
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://localhost:44380/api/broker/estabelecimento/login",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\t\"UserName\" : \"caio.fontes\",\n\t\"Password\": \"123456\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

...

{
    "created": 13212313212,
    "expires_In": 5165155,
    "access_Token": "uasdflsnavin90a9d.eyJ1bmlxdWVfbmFtZSI6IkJpdFNlZ3Vyb3MiLCJqdGkiOiIwYTRjNjY5ZjkzY2M0NDhkOGM1ZmMwODQ3MTUyZGZjYiIsIk5ldENvcmVVc2VySWQiOiI1NzAxNDU5MC03ZTc3LTQ2ZjEtY2NhMy0wOGQ4NzU1NWE3NDAiLCJSb2xlTGV2ZWwiOiIxIiwiTm9tZUNsaWVudGVCcm9rZXIiOiJCaXRTZWd1cm9zIiwiSWRQYXJjZWlybyI6IjQiLCJJZFJlZGUiOiIxIiwiSWRFc3RhYmVsZWNpbWVudG8iOiIwIiwiSWRFc3RhYmVsZWNpbWVudG9PcGVyYWRvciI6IjAiLCJuYmYiOjE2MDc2Mjg3NjcsImV4cCI6MTc2NTMwODc2NywiaWF0IjoxNjA3NjI4NzY3LCJpc3MiOiJTc29BdWRpZW5jZSIsImF1ZCI6IlNzb0F1ZGllbmNlIn0.gIr17raPnYoFX_IIj7KqG1prdKyET6mNZeYXv3sf8sA",
    "userId": "51034597-9e13-46f1-cca3-01d37555a740",
    "token_Type": "Bearer"
}