NAV -image
javascript

Introduction

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

Base URL

https://wiringdiagrams.api.diesellaptops.com

Authenticating requests

To authenticate requests, include a DL-Authorization header with the value "{YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You get API token in the response after Authorization on https://api.users.diesellaptops.com.

Documents

List

Retrieve all diagrams.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram?search=necessitatibus&sort_by=name&sort_dir=desc&page=2&per_page=8" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram"
);

let params = {
    "search": "necessitatibus",
    "sort_by": "name",
    "sort_dir": "desc",
    "page": "2",
    "per_page": "8",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):

{
    "data": [
        {
            "id": 4,
            "name": "2.PDF",
            "token": "a86519d593f75dff075dea4b257649c9",
            "preview_pages": "1",
            "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
            "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
            "type_ids": [
                1
            ],
            "size": "225.3Kb",
            "types": [
                {
                    "id": 1,
                    "year_id": 162,
                    "module_id": null,
                    "name": "Aliquam fermentum tincidunt",
                    "diagram_id": 4
                }
            ]
        }
    ]
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

GET api/v1/diagram

Query Parameters

search  string optional  
Filter results by the search query.

sort_by  string optional  
What column to sort the results on. Default: 'name'.

sort_dir  string optional  
Sort direction. Default: 'asc'. Possible values: 'asc', 'desc'.

page  integer optional  
Which page of results to return. Default: 1.

per_page  integer optional  
How many rows to return per page. Default: 10; maximum: 100. example: 20

Retrieve

Retrieve the diagram.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/18" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/18"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):

{
    "data": {
        "id": 4,
        "name": "2.PDF",
        "token": "a86519d593f75dff075dea4b257649c9",
        "preview_pages": "1",
        "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
        "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
        "type_ids": [
            1
        ],
        "size": "225.3Kb",
        "types": [
            {
                "id": 1,
                "year_id": 162,
                "module_id": null,
                "name": "Aliquam fermentum tincidunt",
                "diagram_id": 4
            }
        ]
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

GET api/v1/diagram/{id}

URL Parameters

id  integer optional  
ID of the diagram.

Create

Create new diagram.

Example request:

curl -X POST \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -F "name=Allison-WTECIII-TransID1.pdf" \
    -F "preview_pages=1-3,4" \
    -F "type_ids[]=[1,3,15]" \
    -F "pdf=@/tmp/phpdwz1Bw" 
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

const body = new FormData();
body.append('name', 'Allison-WTECIII-TransID1.pdf');
body.append('preview_pages', '1-3,4');
body.append('type_ids[]', '[1,3,15]');
body.append('pdf', document.querySelector('input[name="pdf"]').files[0]);

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

Example response (200):

{
    "data": {
        "id": 4,
        "name": "2.PDF",
        "token": "a86519d593f75dff075dea4b257649c9",
        "preview_pages": "1",
        "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
        "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
        "type_ids": [
            1
        ],
        "size": "225.3Kb",
        "types": [
            {
                "id": 1,
                "year_id": 162,
                "module_id": null,
                "name": "Aliquam fermentum tincidunt",
                "diagram_id": 4
            }
        ]
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}

Request      

POST api/diagram

Body Parameters

name  string  
The name of the diagram.

pdf  file  
Diagram PDF file.

preview_pages  string optional  
Pages to be shown in preview. Default: 1.

type_ids[]  array optional  
IDs of linked type.

Update

Update the diagram.

Example request:

curl -X PUT \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/19" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -F "name=Allison-WTECIII-TransID1.pdf" \
    -F "preview_pages=1-3,4" \
    -F "type_ids[]=[1,3,15]" \
    -F "pdf=@/tmp/phppBrkty" 
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/19"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

const body = new FormData();
body.append('name', 'Allison-WTECIII-TransID1.pdf');
body.append('preview_pages', '1-3,4');
body.append('type_ids[]', '[1,3,15]');
body.append('pdf', document.querySelector('input[name="pdf"]').files[0]);

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

Example response (200):

{
    "data": {
        "id": 4,
        "name": "2.PDF",
        "token": "a86519d593f75dff075dea4b257649c9",
        "preview_pages": "1",
        "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
        "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
        "type_ids": [
            1
        ],
        "size": "225.3Kb",
        "types": [
            {
                "id": 1,
                "year_id": 162,
                "module_id": null,
                "name": "Aliquam fermentum tincidunt",
                "diagram_id": 4
            }
        ]
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}

Request      

PUT api/diagram/{id}

URL Parameters

id  integer optional  
ID of the diagram.

Body Parameters

name  string  
The name of the diagram.

pdf  file optional  
Diagram PDF file.

preview_pages  string optional  
Pages to be shown in preview. Default: 1.

type_ids[]  array optional  
IDs of linked type.

Partial Update

Update one or more fields of the diagram instance.

Example request:

curl -X PATCH \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/5" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -F "name=Allison-WTECIII-TransID1.pdf" \
    -F "preview_pages=1-3,4" \
    -F "type_ids[]=[1,3,15]" \
    -F "pdf=@/tmp/phphBcz5v" 
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/5"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

const body = new FormData();
body.append('name', 'Allison-WTECIII-TransID1.pdf');
body.append('preview_pages', '1-3,4');
body.append('type_ids[]', '[1,3,15]');
body.append('pdf', document.querySelector('input[name="pdf"]').files[0]);

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

Example response (200):

{
    "data": {
        "id": 4,
        "name": "2.PDF",
        "token": "a86519d593f75dff075dea4b257649c9",
        "preview_pages": "1",
        "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
        "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
        "type_ids": [
            1
        ],
        "size": "225.3Kb",
        "types": [
            {
                "id": 1,
                "year_id": 162,
                "module_id": null,
                "name": "Aliquam fermentum tincidunt",
                "diagram_id": 4
            }
        ]
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name may not be greater than 255 characters."
        ]
    }
}

Request      

PATCH api/diagram/{id}

URL Parameters

id  integer optional  
ID of the diagram.

Body Parameters

name  string optional  
The name of the diagram.

pdf  file optional  
Diagram PDF file.

preview_pages  string optional  
Pages to be shown in preview. Default: 1.

type_ids[]  array optional  
IDs of linked type.

Delete

Delete the diagram.

Example request:

curl -X DELETE \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/11" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/11"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):


[]

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

DELETE api/diagram/{id}

URL Parameters

id  integer optional  
ID of the diagram.

Attach

Attach new PDF file to the diagram.

Example request:

curl -X POST \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/totam/attach" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -F "preview_pages=1-3,4" \
    -F "pdf=@/tmp/php50gxSv" 
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/totam/attach"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

const body = new FormData();
body.append('preview_pages', '1-3,4');
body.append('pdf', document.querySelector('input[name="pdf"]').files[0]);

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

Example response (200):

{
    "data": {
        "id": 4,
        "name": "2.PDF",
        "token": "a86519d593f75dff075dea4b257649c9",
        "preview_pages": "1",
        "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
        "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
        "type_ids": [
            1
        ],
        "size": "225.3Kb",
        "types": [
            {
                "id": 1,
                "year_id": 162,
                "module_id": null,
                "name": "Aliquam fermentum tincidunt",
                "diagram_id": 4
            }
        ]
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name may not be greater than 255 characters."
        ]
    }
}

Request      

POST api/diagram/{id}/attach

URL Parameters

id  string  

Body Parameters

preview_pages  string optional  
Pages to be shown in preview. Default: 1.

pdf  file optional  
Diagram PDF file.

Import

Import documents from .zip archive. Archive must have a file data.csv and a folder files. data.csv must have the following columns: Filename,Industry,Make,Model,Year Range,Module,Document Type. The folder files must contain all PDF files specified in the column Filename of the data.csv.

Example request:

curl -X POST \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/import" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -F "notify=dolorem" \
    -F "data=@/tmp/phpqaAm5v" 
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/import"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

const body = new FormData();
body.append('notify', 'dolorem');
body.append('data', document.querySelector('input[name="data"]').files[0]);

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

Example response (200):

{
    "data": "The import has been scheduled. A notification will be sent to john.doe@example.com when it is completed."
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "import-data": [
            "The notify field is required."
        ]
    }
}

Request      

POST api/diagram/import

Body Parameters

data  file  
Data archive in `zip` format. It must contain the file *data.csv* and the folder *files* with PDF documents. *data.csv* mus have the following format: `Filename,Industry,Make,Model,Year Range,Module,Document Type`

notify  string optional  
Email address to send the notification about complete import.

Export

Export diagram data.

Example request:

curl -X POST \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/export" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"notify":"aut"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram/export"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "notify": "aut"
}

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

Example response (200):

{
    "data": "The import has been scheduled. A notification will be sent to john.doe@example.com when it is completed."
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "import-data": [
            "The notify field is required."
        ]
    }
}

Request      

POST api/diagram/export

Body Parameters

notify  string optional  
Email address to send the notification about complete import.

View

Retrieve the diagram PDF file.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/consequuntur/diagram" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/consequuntur/diagram"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):


PDF file

Request      

GET api/v1/diagram/{jwt_token}/diagram

URL Parameters

jwt_token  string  

Preview

Retrieve the preview file of the diagram.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/ut/preview" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram/ut/preview"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):


PDF file

Request      

GET api/v1/diagram/{token}/preview

URL Parameters

token  string  

Reports

Download the report

Download the generated report.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/report/NG94HExPwxSwuP84O1pmIeNhZzlhRKvR" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/report/NG94HExPwxSwuP84O1pmIeNhZzlhRKvR"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):


file

Request      

GET api/report/{token}

URL Parameters

token  string  
Token or name in format token.pdf of attachment to fetch.

Statistics

Active Users

Retrieve statistics on active users.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/stat/active-users" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"from":"laudantium","to":"quos"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/stat/active-users"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "from": "laudantium",
    "to": "quos"
}

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

Example response (200):

{
    "data": [
        {
            "qty": 12345,
            "month": "2021-01"
        }
    ]
}

Request      

GET api/stat/active-users

Body Parameters

from  string optional  
Date of the report beginning.

to  string optional  
Date of the report end.

Downloads

Retrieve statistics on downloads.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/stat/downloads" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"from":"fugiat","to":"dolores"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/stat/downloads"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "from": "fugiat",
    "to": "dolores"
}

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

Example response (200):

{
    "data": [
        {
            "qty": 12345,
            "month": "2021-01"
        }
    ]
}

Request      

GET api/stat/downloads

Body Parameters

from  string optional  
Date of the report beginning.

to  string optional  
Date of the report end.

Top Users

Retrieve statistics on most active users.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/stat/top-users" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"max":9,"from":"hic","to":"consectetur"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/stat/top-users"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "max": 9,
    "from": "hic",
    "to": "consectetur"
}

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

Example response (200):

{
    "data": [
        {
            "qty": 123,
            "user_id": 1
        }
    ]
}

Request      

GET api/stat/top-users

Body Parameters

max  integer optional  
Maximum quantity of users. Default: 25.

from  string optional  
Date of the report beginning.

to  string optional  
Date of the report end.

Top Diagrams

Retrieve statistics on the most viewed diagrams.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/stat/top-diagrams" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"max":10,"from":"mollitia","to":"itaque"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/stat/top-diagrams"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "max": 10,
    "from": "mollitia",
    "to": "itaque"
}

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

Example response (200):

{
    "data": [
        {
            "id": 4,
            "name": "2.PDF",
            "token": "a86519d593f75dff075dea4b257649c9",
            "preview_pages": "1",
            "url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImE4NjUxOWQ1OTNmNzVkZmYwNzVkZWE0YjI1NzY0OWM5IiwidXNlcl9pZCI6MjkyNCwic3Vic2NyaWJlZCI6dHJ1ZSwiaWF0IjoxNjM3MTUyMzk3fQ.HquAP5dlBXq072cD3iVzJ8q-I-0Q8jaIKuz_3djTU_c\/diagram",
            "preview_url": "https:\/\/wiringdiagrams.api.diesellaptops.com\/api\/v1\/diagram\/a86519d593f75dff075dea4b257649c9\/preview?cache-buster=1637152395",
            "type_ids": [
                1
            ],
            "size": "225.3Kb",
            "types": [
                {
                    "id": 1,
                    "year_id": 162,
                    "module_id": null,
                    "name": "Aliquam fermentum tincidunt",
                    "diagram_id": 4
                }
            ],
            "qty": 1234
        }
    ]
}

Request      

GET api/stat/top-diagrams

Body Parameters

max  integer optional  
Maximum quantity of diagrams. Default: 25.

from  string optional  
Date of the report beginning.

to  string optional  
Date of the report end.

Requests

Retrieve statistics on requests.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/stat/requests" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"from":"hic","to":"nostrum","per":"month"}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/stat/requests"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "from": "hic",
    "to": "nostrum",
    "per": "month"
}

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

Example response (200):

{
    "data": [
        {
            "qty": 12345,
            "period": "2021-01"
        }
    ]
}

Request      

GET api/stat/requests

Body Parameters

from  string optional  
Date of the report beginning.

to  string optional  
Date of the report end.

per  How optional  
to group the report. Default: 'day'. Possible values: 'month', 'day'.

Types

List

Retrieve all types.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram_type" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram_type"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):

{
    "data": [
        {
            "id": 1,
            "year_id": 162,
            "module_id": null,
            "name": "Aliquam fermentum tincidunt",
            "diagram_id": null
        }
    ]
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

GET api/v1/diagram_type

Retrieve

Retrieve the type.

Example request:

curl -X GET \
    -G "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram_type/8" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/v1/diagram_type/8"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):

{
    "data": {
        "id": 1,
        "year_id": 162,
        "module_id": null,
        "name": "Aliquam fermentum tincidunt",
        "diagram_id": null
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

GET api/v1/diagram_type/{id}

URL Parameters

id  integer optional  
ID of the type.

Create

Create new type.

Example request:

curl -X POST \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"year_id":4,"module_id":18,"name":"Motor Control Module 2.1","diagram_id":5}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "year_id": 4,
    "module_id": 18,
    "name": "Motor Control Module 2.1",
    "diagram_id": 5
}

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

Example response (200):

{
    "data": {
        "id": 1,
        "year_id": 162,
        "module_id": null,
        "name": "Aliquam fermentum tincidunt",
        "diagram_id": null
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}

Request      

POST api/diagram_type

Body Parameters

year_id  integer optional  
ID of the year range. One of 'year_id' or 'module_id' is required.

module_id  integer optional  
ID of the year range. One of 'year_id' or 'module_id' is required.

name  string  
The name of the type.

diagram_id  integer optional  
ID of the diagram.

Update

Update the type.

Example request:

curl -X PUT \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/4" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"year_id":2,"module_id":14,"name":"Motor Control Module 2.1","diagram_id":19}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/4"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "year_id": 2,
    "module_id": 14,
    "name": "Motor Control Module 2.1",
    "diagram_id": 19
}

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

Example response (200):

{
    "data": {
        "id": 1,
        "year_id": 162,
        "module_id": null,
        "name": "Aliquam fermentum tincidunt",
        "diagram_id": null
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}

Request      

PUT api/diagram_type/{id}

URL Parameters

id  integer optional  
ID of the type.

Body Parameters

year_id  integer optional  
ID of the year range. One of 'year_id' or 'module_id' is required.

module_id  integer optional  
ID of the year range. One of 'year_id' or 'module_id' is required.

name  string  
The name of the type.

diagram_id  integer optional  
ID of the diagram.

Partial Update

Update one or more fields of the type instance.

Example request:

curl -X PATCH \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/15" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}" \
    -d '{"year_id":4,"module_id":5,"name":"Motor Control Module 2.1","diagram_id":2}'
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/15"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

let body = {
    "year_id": 4,
    "module_id": 5,
    "name": "Motor Control Module 2.1",
    "diagram_id": 2
}

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

Example response (200):

{
    "data": {
        "id": 1,
        "year_id": 162,
        "module_id": null,
        "name": "Aliquam fermentum tincidunt",
        "diagram_id": null
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Example response (422):

{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name may not be greater than 255 characters."
        ]
    }
}

Request      

PATCH api/diagram_type/{id}

URL Parameters

id  integer optional  
ID of the type.

Body Parameters

year_id  integer optional  
ID of the year range.

module_id  integer optional  
ID of the year range.

name  string optional  
The name of the type.

diagram_id  integer optional  
ID of the diagram.

Delete

Delete the type.

Example request:

curl -X DELETE \
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/18" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "DL-Authorization: {YOUR-API-KEY}"
const url = new URL(
    "https://wiringdiagrams.api.diesellaptops.com/api/diagram_type/18"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "DL-Authorization": "{YOUR-API-KEY}",
};

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

Example response (200):


[]

Example response (401):

{
    "message": "Unauthenticated."
}

Request      

DELETE api/diagram_type/{id}

URL Parameters

id  integer optional  
ID of the type.