Mudanças entre as edições de "Controllr/API/REST-HTTP"

De BrByte Wiki
< Controllr‎ | API
(Criou página com ' ############################################################ # Requisição de LOGIN ############################################################ Requisição POST para http...')
 
Linha 1: Linha 1:
  
############################################################
+
== Requisição de LOGIN ==
# Requisição de LOGIN
 
############################################################
 
  
 
Requisição POST para http://[IP-SERVIDOR]:8080/login
 
Requisição POST para http://[IP-SERVIDOR]:8080/login
 
com body username=USER&password=PASS
 
com body username=USER&password=PASS
  
curl -i -X POST \
+
    curl -i -X POST \
  -H "Content-Type:application/x-www-form-urlencoded" \
+
        -H "Content-Type:application/x-www-form-urlencoded" \
  -H "Accept:application/json" \
+
        -H "Accept:application/json" \
  -d "username=admin" \
+
        -d "username=admin" \
  -d "password=admin" \
+
        -d "password=admin" \
'http://192.168.142.23:8080/login'
+
      'http://192.168.142.23:8080/login'
  
 
+
RESPOSTA - pegar o cookie do cabeçalho Set-Cookie
############################################################
 
# RESPOSTA - pegar o cookie do cabeçalho Set-Cookie
 
############################################################
 
  
 
Na resposta do Login, capturar o cookie que será usado para requisição
 
Na resposta do Login, capturar o cookie que será usado para requisição
  
HTTP/1.1 200 OK
+
    HTTP/1.1 200 OK
Server: nginx/1.10.2
+
    Server: nginx/1.10.2
Date: Fri, 20 Apr 2018 20:46:26 GMT
+
    Date: Fri, 20 Apr 2018 20:46:26 GMT
Content-Type: application/json
+
    Content-Type: application/json
Content-Length: 17
+
    Content-Length: 17
Connection: keep-alive
+
    Connection: keep-alive
Set-Cookie: BRBOSCookie=c7a361caa000fab3680a558910c4f33c; expires=Sat, 20 Apr 2019 20:56:26 GMT; path=/
+
    Set-Cookie: BRBOSCookie=c7a361caa000fab3680a558910c4f33c; expires=Sat, 20 Apr 2019 20:56:26 GMT; path=/
 
+
   
{"success": true}
+
    {"success": true}
 
 
  
############################################################
 
  
 
Para capturar as informações do Dashboard, fazer uma requisição para
 
Para capturar as informações do Dashboard, fazer uma requisição para
  
/controllrctl/dashboard/info
+
    /controllrctl/dashboard/info
  
 
Usando o Cookie previamente autenticado
 
Usando o Cookie previamente autenticado
  
  
curl -i -X GET \
+
    curl -i -X GET \
  -H "Accept:application/json" \
+
      -H "Accept:application/json" \
  -H "Cookie:BRBOSCookie=af3a254b467d7480173f1d739a380d1e" \
+
      -H "Cookie:BRBOSCookie=af3a254b467d7480173f1d739a380d1e" \
'http://192.168.142.23:8080/controllrctl/dashboard/info'
+
    'http://192.168.142.23:8080/controllrctl/dashboard/info'

Edição das 14h42min de 20 de abril de 2018

Requisição de LOGIN

Requisição POST para http://[IP-SERVIDOR]:8080/login com body username=USER&password=PASS

   curl -i -X POST \
       -H "Content-Type:application/x-www-form-urlencoded" \
       -H "Accept:application/json" \
       -d "username=admin" \
       -d "password=admin" \
     'http://192.168.142.23:8080/login'

RESPOSTA - pegar o cookie do cabeçalho Set-Cookie

Na resposta do Login, capturar o cookie que será usado para requisição

   HTTP/1.1 200 OK
   Server: nginx/1.10.2
   Date: Fri, 20 Apr 2018 20:46:26 GMT
   Content-Type: application/json
   Content-Length: 17
   Connection: keep-alive
   Set-Cookie: BRBOSCookie=c7a361caa000fab3680a558910c4f33c; expires=Sat, 20 Apr 2019 20:56:26 GMT; path=/
   
   {"success": true}


Para capturar as informações do Dashboard, fazer uma requisição para

   /controllrctl/dashboard/info

Usando o Cookie previamente autenticado


   curl -i -X GET \
      -H "Accept:application/json" \
      -H "Cookie:BRBOSCookie=af3a254b467d7480173f1d739a380d1e" \
    'http://192.168.142.23:8080/controllrctl/dashboard/info'