1. Home
  2. API
  3. API documentatie

API documentatie

Endpoint

De API is te bereiken op https://[subdomein].inserve-api.nl. Alle responses zijn in het JSON formaat.

Authenticatie

Maak als ingelogde gebruiker een API-key aan via het profielmenu -> API instellingen > API sleutels. Gebruik deze bij elke request. Je kunt de authenticatie testen met het /auth/me endpoint, vervang hieronder [apikey] met een API sleutel:

GET https://[subdomein].inserve-api.nl/auth/me

HeadersX-Api-Key: [apikey]
Parameters(leeg)
Response{ "id": 1, "email": "test@example.com", "...": "..." }

Voorbeeld

Gebruik de inspector in de browser om alle calls te bekijken. Alle calls in de front-end kunnen ook gebruikt worden met een API-key.

Tickets

GEThttps://support.inserve-api.nl/tickets

Query (JSON-encoded)(Zie querybuilder)
{ "builder": [ { "orderByDesc": "created_at" }, { "paginate": 15 } ], "page": 1 }
Response{ "current_page": 1, "data": [ { "id": 9, "reference": "ZYL7R", "description": "test", "client_id": 9, "operator_id": 1, "status_id": 0, "created_at": "2019-06-25T16:29:00+0200", "updated_at": "2019-06-27T13:35:02+0200", "priority": 1, "ticket_time_registrations_sum": null, "operator": { "id": 1, "email": "admin@innovaat.nl", "email_verified_at": null, "first_name": "abc", "last_name": "abc", "telephone_cell": null, "telephone": null, "companies": [], "remember_token": null, "created_at": "2019-06-07T17:19:56+0200", "updated_at": "2019-06-07T17:19:56+0200", "deleted_at": null, "roles_ids": [ 1 ], "roles": [ { "id": 1, "name": "operator", "display_name": "Behandelaar", "description": null, "created_at": "2019-06-07 13:56:48", "updated_at": "2019-06-07 13:56:48", "pivot": { "user_id": 1, "role_id": 1 } } ] }, "client": { "id": 9, "email": "hans@hanos.nl", "email_verified_at": null, "first_name": "Hans", "last_name": null, "telephone_cell": "06-2348912304", "telephone": "0487-623489", "company_id": 1, "remember_token": null, "created_at": "2019-06-25T16:28:56+0200", "updated_at": "2019-06-25T17:05:46+0200", "deleted_at": null, "roles_ids": [ 2 ], "company": { "id": 1, "name": "Xenos BV", "debtor_code": null, "address_1": "Weg", "address_2": "2", "postal_code": "5881 AM", "telephone": "0412", "logo": null, "city": "Boxmeer", "country": "Nederland", "created_at": "2019-06-20T16:53:46+0200", "updated_at": "2019-06-25T14:34:14+0200" }, "roles": [ { "id": 2, "name": "client", "display_name": "Contactpersoon", "description": null, "created_at": "2019-06-07 13:56:48", "updated_at": "2019-06-07 13:56:48", "pivot": { "user_id": 9, "role_id": 2 } } ] } } ], "first_page_url": "http://test.myapp.com/tickets?page=1", "from": 1, "last_page": 1, "last_page_url": "http://test.myapp.com/tickets?page=1", "next_page_url": null, "path": "http://test.myapp.com/tickets", "per_page": "15", "prev_page_url": null, "to": 1, "total": 1 }

Query builder

De API gebruikt de Query Builder van Laravel om objecten op te halen. Hier een aantal voorbeelden:

Query filtering{"builder":[{"where":["status_id",4]},{"where":["created_at",">","2019-06-30 15:00:00"]},{"whereIn":["status_id",[2,3,4]]},{"s":"John Doe"}]}
Query ordering{"builder":[{"orderBy":"created_at"},{"orderByDesc":"created_at"}]}
Query relations{"builder":[{"with":["client","client.company"]},{"withCount":"ticketMessages"}]}
Modifiers (leave empty for all results){"builder":[{"count":["*"]},{"paginate":15}]}
Example 1{"builder":[{"whereIn":["status_id",[2,3,4]]},{"paginate":15}]}
Laatste update op 31 mei 2022

Had je hier iets aan?

Gerelateerde artikelen