MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>

Authenticating requests

This API is not authenticated.

Endpoints

GET api/user

Example request:
curl --request GET \
    --get "http://localhost/api/user" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/user"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/user

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Display a listing of the products with pagination.

Example request:
curl --request GET \
    --get "http://localhost/api/products" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/products"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "current_page": 1,
    "data": [],
    "first_page_url": "http://localhost/api/products?page=1",
    "from": null,
    "last_page": 1,
    "last_page_url": "http://localhost/api/products?page=1",
    "links": [
        {
            "url": null,
            "label": "&laquo; Previous",
            "active": false
        },
        {
            "url": "http://localhost/api/products?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "Next &raquo;",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://localhost/api/products",
    "per_page": 10,
    "prev_page_url": null,
    "to": null,
    "total": 0
}
 

Request      

GET api/products

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Store a newly created product in storage.

Example request:
curl --request POST \
    "http://localhost/api/products" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"b\",
    \"full_name\": \"n\",
    \"group_id\": 16,
    \"kind_id\": 16,
    \"code\": \"n\",
    \"article\": \"g\",
    \"unit\": \"z\",
    \"vat_rate\": \"m\",
    \"image\": \"i\",
    \"description\": \"Eius et animi quos velit et.\"
}"
const url = new URL(
    "http://localhost/api/products"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "b",
    "full_name": "n",
    "group_id": 16,
    "kind_id": 16,
    "code": "n",
    "article": "g",
    "unit": "z",
    "vat_rate": "m",
    "image": "i",
    "description": "Eius et animi quos velit et."
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/products

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

Must not be greater than 255 characters. Example: b

full_name   string     

Must not be greater than 255 characters. Example: n

group_id   integer  optional    

The id of an existing record in the groups table. Example: 16

kind_id   integer  optional    

Assuming 'groups' table exists. The id of an existing record in the kinds table. Example: 16

code   string     

Assuming 'kinds' table exists. Must not be greater than 255 characters. Example: n

article   string     

Must not be greater than 255 characters. Example: g

unit   string     

Must not be greater than 255 characters. Example: z

vat_rate   string     

Must not be greater than 255 characters. Example: m

image   string  optional    

Must not be greater than 255 characters. Example: i

description   string  optional    

Example: Eius et animi quos velit et.

Display the specified product.

Example request:
curl --request GET \
    --get "http://localhost/api/products/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/products/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 

{
    "error": "Product not found"
}
 

Request      

GET api/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the product. Example: architecto

Update the specified product in storage.

Example request:
curl --request PUT \
    "http://localhost/api/products/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"b\",
    \"full_name\": \"n\",
    \"group_id\": 16,
    \"kind_id\": 16,
    \"code\": \"n\",
    \"article\": \"g\",
    \"unit\": \"z\",
    \"vat_rate\": \"m\",
    \"image\": \"i\",
    \"description\": \"Eius et animi quos velit et.\"
}"
const url = new URL(
    "http://localhost/api/products/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "b",
    "full_name": "n",
    "group_id": 16,
    "kind_id": 16,
    "code": "n",
    "article": "g",
    "unit": "z",
    "vat_rate": "m",
    "image": "i",
    "description": "Eius et animi quos velit et."
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

PUT api/products/{id}

PATCH api/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the product. Example: architecto

Body Parameters

name   string  optional    

Must not be greater than 255 characters. Example: b

full_name   string  optional    

Must not be greater than 255 characters. Example: n

group_id   integer  optional    

The id of an existing record in the groups table. Example: 16

kind_id   integer  optional    

The id of an existing record in the kinds table. Example: 16

code   string  optional    

Must not be greater than 255 characters. Example: n

article   string  optional    

Must not be greater than 255 characters. Example: g

unit   string  optional    

Must not be greater than 255 characters. Example: z

vat_rate   string  optional    

Must not be greater than 255 characters. Example: m

image   string  optional    

Must not be greater than 255 characters. Example: i

description   string  optional    

Example: Eius et animi quos velit et.

Remove the specified product from storage.

Example request:
curl --request DELETE \
    "http://localhost/api/products/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/products/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the product. Example: architecto