NAV
javascript

Introduction

Welcome to the generated API reference.

Do you use Postman? Great.
Get Postman Collection
Get Postman Environment

Header

Header Value When should I send?
Accept application/json All requests
Content-Type application/x-www-form-urlencoded Must send when passing query string in request body
Content-Type application/json Must send when passing json in request body
Content-Type multipart/form-data Must send when passing files in request body
Authorization Bearer access_token Whenever the resource requires an authenticated user
Language language All requests

Controlling requests

All API requests are limited to prevent abuse and ensure stability.
The limit is usually 120 requests every 1 minute. But each route can have its own limit.
You can always check the response header to have a status of available requests:

X-RateLimit-Limit → 120
X-RateLimit-Remaining → 25

Errors

API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request sucks
401 Unauthorized -- Your API key is wrong
403 Forbidden -- You are not authorized or do not have permission to access
404 Not Found -- The specified page can not be found
405 Method Not Allowed -- Method not allowed for this request
406 Not Acceptable -- You have requested a format that is not valid
410 Gone -- The target resource is no longer available
413 Payload Too Large -- Request payload is larger than the server is willing or able to process
422 Unprocessable Entity -- Validation error, the given data was invalid
429 Too Many Requests -- You have sent too many requests in a certain amount of time ("rate limiting")
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.

Cliente

Consultar clientes

Example request:

const axios = require('axios');

axios({
    "method": "get",
    "url": "https://erp-fazfertil/api/v1/admin/clientes",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Accept": "application/json",
        "Language": "{language}"
    }})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "clientes": [
        {
            "razao_social": "valor",
            "cnpj": "valor",
            "inscricao": "valor",
            "isento": "valor",
            "telefone": "valor",
            "nome": "valor",
            "email": "valor",
            "cpf": "valor",
            "email_faturamento": "valor",
            "credito_pre_aprovado": "valor",
            "ativo": "valor",
            "endereco": "valor",
            "cep": "valor",
            "numero": "valor",
            "complemento": "valor",
            "bairro": "valor",
            "cidade": "valor",
            "estado": "valor"
        }
    ]
}

HTTP Request

GET api/v1/admin/clientes

Query Parameters

Parameter Type Validation Description
limit integer integer Default: 20 Max: 100
page integer integer
orderBy string string Default: id:asc.
Available fields: id nome email ativo created_at updated_at
search string string Search in the fields: uuid nome email
ativo integer integer Available values: 0 1
created_at[0] string string ISO 8601 Y-m-d\TH:i:sP Initial date
created_at[1] string string ISO 8601 Y-m-d\TH:i:sP Final date

Criar cliente

Example request:

const axios = require('axios');

axios({
    "method": "post",
    "url": "https://erp-fazfertil/api/v1/admin/clientes",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json",
        "Language": "{language}"
    },
    "data": {
        "razao_social": "Occaecati repellat eum aut quia nihil fugit nemo.",
        "cnpj": "Quibusdam dolores eum impedit nisi nostrum quod est.",
        "inscricao": "Et sed distinctio enim omnis.",
        "isento": "0",
        "telefone": "Error facere et ipsum qui dolor.",
        "nome": "Sra. Em\u00edlia Andr\u00e9ia Urias",
        "cpf": "Deleniti velit ratione ut natus non.",
        "email": "karine.verdugo@example.org",
        "email_faturamento": "saulo.bittencourt@example.com",
        "credito_pre_aprovado": 5.478046,
        "endereco": "Aut velit eum doloremque delectus harum et porro magnam.",
        "cep": "Doloribus porro veritatis alias quisquam nihil omnis dignissimos.",
        "numero": "Nam eveniet quis esse doloremque.",
        "complemento": "Qui quia vero voluptas voluptas et.",
        "bairro": "Id et eos laudantium nihil.",
        "cidade": "Aliquid optio dolorum ut.",
        "estado": "Qui voluptate qui corporis aut.",
        "ativo": "0"
}
})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "status": 200
}

HTTP Request

POST api/v1/admin/clientes

Parameters

Parameter Type Validation Description
razao_social string required|string|max:191
cnpj string required|string|max:191
inscricao string required|string|max:191
isento boolean boolean Default false
telefone string nullable|string|max:191
nome string required|string|max:191
cpf string required|string|max:191
email string required|string|email|max:100
email_faturamento string required|string|email|max:100
credito_pre_aprovado float nullable|number
endereco string required|string|max:191
cep string required|string|max:191
numero string required|string|max:191
complemento string required|string|max:191
bairro string required|string|max:191
cidade string required|string|max:191
estado string required|string|max:191
ativo boolean boolean Default true

Atualizar cliente

Example request:

const axios = require('axios');

axios({
    "method": "put",
    "url": "https://erp-fazfertil/api/v1/admin/clientes/{codigoCliente}",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json",
        "Language": "{language}"
    },
    "data": {
        "razao_social": "Odio deleniti et quia quam cum quas.",
        "cnpj": "Qui facere sit rerum saepe.",
        "inscricao": "Autem repellat deserunt eos mollitia velit error.",
        "isento": "0",
        "telefone": "Rerum rem nobis animi consequatur et non quis eligendi.",
        "nome": "Sr. Heitor Robson Aranda Filho",
        "cpf": "Omnis facere harum et qui animi.",
        "email": "jmatos@example.net",
        "email_faturamento": "matos.miriam@example.com",
        "credito_pre_aprovado": 11646086.61,
        "endereco": "Ex eveniet nobis blanditiis ut aut quas sequi.",
        "cep": "Ut et sed quisquam voluptatem laudantium accusamus rerum.",
        "numero": "Sunt voluptate magni itaque quae.",
        "complemento": "Optio temporibus architecto similique officiis.",
        "bairro": "Eveniet et quis molestiae sed tempore itaque.",
        "cidade": "Et necessitatibus eius rerum nesciunt similique.",
        "estado": "Sunt et dolorem velit iusto totam iusto.",
        "ativo": "1"
}
})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "status": 204
}

HTTP Request

PUT api/v1/admin/clientes/{codigoCliente}

Parameters

Parameter Type Validation Description
razao_social string nullable|string|max:191
cnpj string nullable|string|max:191
inscricao string nullable|string|max:191
isento boolean boolean Default false
telefone string nullable|string|max:191
nome string nullable|string|max:191
cpf string nullable|string|max:191
email string nullable|string|email|max:100
email_faturamento string nullable|string|email|max:100
credito_pre_aprovado float nullable|number
endereco string nullable|string|max:191
cep string nullable|string|max:191
numero string nullable|string|max:191
complemento string nullable|string|max:191
bairro string nullable|string|max:191
cidade string nullable|string|max:191
estado string nullable|string|max:191
ativo boolean boolean Default true

Pedidos

Enviar pedido

Example request:

const axios = require('axios');

axios({
    "method": "post",
    "url": "https://erp-fazfertil/api/v1/admin/pedidos",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json",
        "Language": "{language}"
    },
    "data": {
        "numero_pedido": "Qui ut error sit vitae aperiam quidem.",
        "idcliente": 3,
        "metodo_envio": "Saepe laboriosam et quia quisquam tempore.",
        "metodo_pagamento": "Facilis distinctio aut in quisquam.",
        "valor_frete": 40676799.147569284,
        "dias_entrega": "Sra. Mariah Lira",
        "valor_pedido": 657.4355863,
        "valor_pedido_final": 31432270.726,
        "parcelas": "natal49@example.net",
        "valor_desconto": 19.136961,
        "cupom_desconto": "Sunt rerum facere aut omnis quasi provident.",
        "data_criacao": "2019-07-29T00:00:00-03:00",
        "status_pedido": "Eveniet qui ab eum ut quia aperiam."
}
})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "status": 200
}

HTTP Request

POST api/v1/admin/pedidos

Parameters

Parameter Type Validation Description
numero_pedido string required|string|max:191
idcliente integer required|integer
metodo_envio string required|string|max:191
metodo_pagamento string required|string|max:191
valor_frete float required|number
dias_entrega string required|string|max:191
valor_pedido float required|number
valor_pedido_final float required|number
parcelas string required|string|email|max:100
valor_desconto float required|number
cupom_desconto string required|string|max:191
data_criacao string required|string ISO 8601 Y-m-d\TH:i:sP data_criacao
status_pedido string required|string|max:191

Atualizar pedido

Example request:

const axios = require('axios');

axios({
    "method": "put",
    "url": "https://erp-fazfertil/api/v1/admin/pedidos/{codigoPedido}",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json",
        "Language": "{language}"
    },
    "data": {
        "numero_pedido": "Doloremque ipsa vel aperiam.",
        "idcliente": 8,
        "metodo_envio": "Autem aut voluptatem ipsum facilis maxime aut.",
        "metodo_pagamento": "Architecto deleniti possimus et beatae.",
        "valor_frete": 229056443.67999,
        "dias_entrega": "Srta. Sarah Duarte Neto",
        "valor_pedido": 33353.5757,
        "valor_pedido_final": 9312819.10219921,
        "parcelas": "franco.esteves@example.com",
        "valor_desconto": 6879.1797533,
        "cupom_desconto": "Fugiat fugit vitae maxime asperiores illo.",
        "data_criacao": "2019-07-29T00:00:00-03:00",
        "status_pedido": "Quia quia laudantium id possimus."
}
})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "status": 204
}

HTTP Request

PUT api/v1/admin/pedidos/{codigoPedido}

Parameters

Parameter Type Validation Description
numero_pedido string nullable|string|max:191
idcliente integer nullable|integer
metodo_envio string nullable|string|max:191
metodo_pagamento string nullable|string|max:191
valor_frete float nullable|number
dias_entrega string nullable|string|max:191
valor_pedido float nullable|number
valor_pedido_final float nullable|number
parcelas string nullable|string|email|max:100
valor_desconto float nullable|number
cupom_desconto string nullable|string|max:191
data_criacao string nullable|string ISO 8601 Y-m-d\TH:i:sP data_criacao
status_pedido string nullable|string|max:191

Produtos

Consultar produtos

Example request:

const axios = require('axios');

axios({
    "method": "get",
    "url": "https://erp-fazfertil/api/v1/admin/produtos",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Accept": "application/json",
        "Language": "{language}"
    }})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "produtos": [
        {
            "codigo_produto": "valor",
            "nome": "valor",
            "video": "valor",
            "descricao": "valor",
            "como_utilizar": "valor",
            "valor_original": "valor",
            "valor_com_desconto": "valor",
            "estoque": "valor",
            "qtd_max_por_usuario": "valor",
            "qtd_min_por_usuario": "valor",
            "oferta": "valor",
            "destaque": "valor",
            "retirada_na_loja": "valor",
            "precisa_receituario": "valor",
            "altura": "valor",
            "largura": "valor",
            "comprimento": "valor",
            "peso": "valor",
            "ativo": "valor",
            "fotos": [
                {
                    "imagem": "https:\/\/erp-fazfertil\/imagem\/12319d8au9da.png",
                    "ordenacao": 0
                },
                {
                    "imagem": "https:\/\/erp-fazfertil\/imagem\/gdjfkgn5454.png",
                    "ordenacao": 1
                }
            ],
            "categoria": [
                {
                    "id": 15,
                    "titulo": "categoria x",
                    "ordenacao": 1,
                    "ativo": 1
                }
            ],
            "subcategoria": [
                {
                    "id": 24,
                    "titulo": "categoria z",
                    "ordenacao": 2,
                    "ativo": 1
                }
            ],
            "marca": [
                {
                    "id": 13,
                    "titulo": "valor",
                    "ordenacao": "valor",
                    "imagem": "https:\/\/erp-fazfertil\/imagem\/gdjfkgn5454.png",
                    "destaque_home": 0,
                    "ativo": 1
                }
            ],
            "relacionados": [
                {
                    "idproduto": 54
                },
                {
                    "idproduto": 15
                }
            ]
        }
    ]
}

HTTP Request

GET api/v1/admin/produtos

Query Parameters

Parameter Type Validation Description
limit integer integer Default: 20 Max: 100
page integer integer
orderBy string string Default: id:asc.
Available fields: id nome email ativo created_at updated_at
search string string Search in the fields: uuid nome email
ativo integer integer Available values: 0 1
created_at[0] string string ISO 8601 Y-m-d\TH:i:sP Initial date
created_at[1] string string ISO 8601 Y-m-d\TH:i:sP Final date

Consultar estoque

Example request:

const axios = require('axios');

axios({
    "method": "get",
    "url": "https://erp-fazfertil/api/v1/admin/produtos/estoque/{codigoProduto}",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Accept": "application/json",
        "Language": "{language}"
    }})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "estoque": "20"
}

HTTP Request

GET api/v1/admin/produtos/estoque/{codigoProduto}

Atualizar produto

Example request:

const axios = require('axios');

axios({
    "method": "put",
    "url": "https://erp-fazfertil/api/v1/admin/produtos/{codigoProduto}",
    "headers": {
        "Authorization": "Bearer {access_token}",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json",
        "Language": "{language}"
    },
    "data": {
        "nome": "Aperiam et consequatur eaque.",
        "video": "Ullam quis voluptatum officiis molestiae id aperiam quidem.",
        "descricao": "Ipsum explicabo doloribus architecto consequatur.",
        "como_utilizar": "Eaque voluptatem rerum repellat temporibus fuga aut molestiae.",
        "valor_original": 1190.87263,
        "valor_com_desconto": 270179260.4775338,
        "estoque": "Quo nam quia unde laboriosam non incidunt assumenda.",
        "qtd_max_por_usuario": "Rem quibusdam sunt ratione.",
        "qtd_min_por_usuario": "Ut repellat qui est quasi natus.",
        "oferta": "1",
        "destaque": "1",
        "retirada_na_loja": "1",
        "precisa_receituario": "0",
        "altura": 51818.5641,
        "largura": 0,
        "comprimento": 4283.99076,
        "peso": 402022,
        "ativo": "1"
}
})
.then(function (response) {
    // handle success
    console.log(response);
})
.catch(function (error) {
    // handle error
    console.log(error);
})
.finally(function () {
    // optional, always executed
});

Example response:

{
    "status": 204
}

HTTP Request

PUT api/v1/admin/produtos/{codigoProduto}

Parameters

Parameter Type Validation Description
nome string nullable|string|max:191
video string nullable|string|max:255
descricao string nullable|string|max:65535
como_utilizar string nullable|string|max:65535
valor_original float nullable|number
valor_com_desconto float nullable|number
estoque integer nullable|int
qtd_max_por_usuario integer nullable|int
qtd_min_por_usuario integer nullable|int
oferta boolean boolean Default true
destaque boolean boolean Default true
retirada_na_loja boolean boolean Default true
precisa_receituario boolean boolean Default true
altura float nullable|number
largura float nullable|number
comprimento float nullable|number
peso float nullable|number
ativo boolean boolean Default true