Controllr/API/REST-HTTP/Área Administrativa

De BrByte Wiki
< Controllr‎ | API‎ | REST-HTTP
Revisão de 14h43min de 3 de maio de 2019 por Miguel (discussão | contribs)

OBS: A área administrativa, deve ser acessada através da porta WEB que por padrão é a 8080

Exemplo http://192.168.144.10:8080

É diferente do acesso dá área do cliente, que utiliza por padrão a porta 80, através do acesso do Hotsite.

COMANDOS WHERE
FIELD OPER VALUE
Nome da tabela que irá utilizar o filtro Código do comando Where Valor que usará para retornar o filtro desejado
EXEMPLOS
where = [{"field":"client.client_doc1","oper":5,"value":"69120603070"}] Usamos o código 5 do OPER que representa (=) Igualdade
[{"field":"client.client_complete_name","oper":10,"value":"Teste%"}] Usamos o código 10 do OPER que representa o ILIKE, lista todos nomes compatíveis usando o %

"OPER":1 = Menor Que < "OPER":2 = Maior Que > "OPER":3 = Menor ou Igual à <= "OPER":4 = Maior ou Igual à >= "OPER":5 = Igual = "OPER":6 = Diferente != "OPER":7 = é IS "OPER":8 = Não é IS NOT "OPER":9 = LIKE "OPER":10 = ILIKE


Listagem dos Clientes

POST /controllrctl/client/list


  curl -i -X POST \
        -H "Content-Type:application/x-www-form-urlencoded" \
        -H "Accept:application/json" \  
        -d "where: [{"field":"client_status","oper":5,"value":0}]" \
        -d "username: admin" \
        -d "page: 1" \
        -d "start: 0" \
        -d "limit: 15" \
        -d "sort: client_complete_name" \
        -d "dir: ASC" \
        'http://192.168.144.10:8080/controllrctl/client/list'  

Resposta JSON

 
{
    "success": true,
    "total": 493,
    "results": [
        {
            "client_pk": 430,
            "client_status": 3,
            "client_type": 0,
            "client_username": "",
            "client_password": "",
            "client_name": "teste",
            "client_lastname": "brbyte",
            "client_mail": "",
            "client_doc1": "",
            "client_doc2": "",
            "client_date_cad": "2016-09-20 00:00:00",
            "client_date_deactivation": null,
            "client_date_birth": "2016-09-20 00:00:00",
            "client_observations": "",
            "offices_pk": 1,
            "offices_identification": "Matriz",
            "client_complete_name": "teste brbyte",
            "client_phones": null,
            "cli_addr_address": "Rua Oscar Ferreira Bugre",
            "cli_addr_number": "88",
            "cli_addr_neighborhood": "Vila Nasser",
            "cli_addr_zipcode": "79.117-101",
            "cli_addr_province": "Campo Grande",
            "cli_addr_state": "MS",
            "cli_addr_completation": ""
        }
    ]
}


Exemplo de como usar o parâmetro WHERE

Localizar o clientes através do CPF/CNPJ

where = [{"field":"client.client_doc1","oper":5,"value":"69120603070"}]

Localizar o clientes através do nome Completo

where = [{"field":"client.client_complete_name","oper":5,"value":"Teste1 BrByte"}]



"OPER":0 = Nulo NULL "OPER":1 = Menor Que < "OPER":2 = Maior Que > "OPER":3 = Menor ou Igual à <= "OPER":4 = Maior ou Igual à >= "OPER":5 = Igual = "OPER":6 = Diferente != "OPER":7 = é IS "OPER":8 = Não é IS NOT "OPER":9 = LIKE "OPER":10 = ILIKE


Listagem dos Contratos

POST /controllrctl/contract/list


  curl -i -X POST \
        -H "Content-Type:application/x-www-form-urlencoded" \
        -H "Accept:application/json" \  
        -d "where: [{"field":"contract_deleted","oper":5,"value":false},{"field":"AND"},{"field":"contract_status","oper":5,"value":0}]" \
        -d "client_complete_name:" \
        -d "offices_pk: 0" \
        -d "username: admin" \
        -d "page: 1" \        
        -d "start: 0" \
        -d "limit: 15" \
        -d "sort: contract_number" \
        -d "dir: ASC" \
        'http://192.168.144.10:8080/controllrctl/contract/list'  

Resposta JSON


{
    "success": true,
    "total": 1,
    "results": [
        {
            "contract_pk": 466,
            "contract_number": 464,
            "contract_pay_day": 10,
            "contract_free": 0,
            "contract_amount": "45.00",
            "contract_pay_discount": null,
            "contract_date_cad": "2017-02-08 18:30:11",
            "contract_status": 0,
            "contract_deleted": false,
            "contract_observations": "",
            "contract_block_type": 0,
            "contract_date_last_paymentobservation": null,
            "contract_tax_cfop": 5307,
            "contract_tax_icms": "1.25",
            "contract_tax_ibpt": "13.45",
            "contract_block_auto": 1,
            "address_pk": 346,
            "client_pk": 464,
            "client_status": 0,
            "client_type": 0,
            "client_username": "admin",
            "client_password": "admin",
            "client_name": "Teste1",
            "client_lastname": "BrByte",
            "client_mail": "softov@brbyte.com",
            "client_doc1": "69120603070",
            "client_doc2": "",
            "client_date_cad": "2017-02-08 00:00:00",
            "client_date_birth": "2017-02-08 00:00:00",
            "client_complete_name": "Teste1 BrByte",
            "offices_pk": 1,
            "offices_identification": "Matriz",
            "bank_account_pk": 1,
            "bank_account_code": "756",
            "bank_account_identification": "Sicoob Credivale",
            "contract_layouts_pk": 1,
            "client_phones": "Fixo#-#67981234276",
            "cli_addr_address": "",
            "cli_addr_number": "",
            "cli_addr_neighborhood": "",
            "cli_addr_zipcode": "",
            "cli_addr_province": "Grão Pará",
            "cli_addr_state": "SC",
            "cli_addr_completation": "",
            "ctt_addr_address": "",
            "ctt_addr_number": "",
            "ctt_addr_neighborhood": "",
            "ctt_addr_zipcode": "",
            "ctt_addr_province": "Grão Pará",
            "ctt_addr_state": "SC",
            "ctt_addr_completation": ""
        }
    ]
}