This documentation is automatically generated with
Postmanerator
using a Postman collection that is located in the source
code of the application, into utilities/postman/
folder.
This is the complete documentation of Robert 2 private API.
This API exists to be used with a Robert 2 application client (GUI).
Please use you own environment variables. These variables are : robert2_url
, robert2_email
, and robert2_password
.
In this documentation you’ll see that these variables are replaced by the following examples:
url: robert2-api.dev
email: your-email@dev.test
password: ******
.Of course, if you want to use the postman collection, you’ll have to replace those values in your own environment.
Robert 2 API uses JWT Authentication.
At first, always ask for an Auth token by using the AUTH - Token
request. In the response payload (if it’s succesful) there is a token
which should be stored locally, in order to be inserted in all other future requests’ headers, as a Bearer token header
.
Here is an example of Authorization
header value:
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDYyMTc3OTksImV4cCI6MTU0NjIyNDk5OSwidXNl
In postman, this is done automatically by using a global variable auth_token
, which is then used in each requests’ headers.
This is the only way to claim access to the API.
If the given username and password are provided, the response contains a token, which must then be included in every subsequent requests ‘ headers, for them to be authorized access.
POST /api/token/ HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"identifier": "your-email@dev.test",
"password": "******"
}
curl -X POST -H "Content-Type: application/json" -d '{
"identifier": "your-email@dev.test",
"password": "******"
}' "http://robert2-api.dev/api/token/"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Cache-Control | private, no-cache |
Content-Type | application/json;charset=utf-8 |
|
Bills are attached to events, beneficiaries and contain materials. You can create bills (with a discount rate) and delete them, it’s not possible to update them. When a bill is created, a PDF file is generated within the /data/bills
folder.
The number of a bill is composed by the current date (format Ymd
) and the id
of the attached event.
Create a bill for a given event. This also creates a PDF file, and removes any existing bill for the event.
POST /api/events/1/bill HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"discountRate": 10.0
}
curl -X POST -H "Content-Type: application/json" -d '{
"discountRate": 10.0
}
' "http://robert2-api.dev/api/events/1/bill"
Status | 201 Created |
---|---|
Content-Type | application/json |
|
Retreive one bill data.
GET /api/bills/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/bills/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Remove a bill using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/bills/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/bills/1"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Categories are simple entities that allows to tidy up materials. Each category may have several sub-categories.
Just give a name, and here you go.
POST /api/categories HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "newCateg"
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "newCateg"
}
' "http://robert2-api.dev/api/categories"
Status | 401 Unauthorized |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 401 Unauthorized |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 401 Unauthorized |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Change the name of a category.
PUT /api/categories/3 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": null
}
curl -X PUT -H "Content-Type: application/json" -d '{
"name": null
}
' "http://robert2-api.dev/api/categories/3"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 401 Unauthorized |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the categories of the application, with their nested sub-categories, sorted by name, and within pagination.
GET /api/categories HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
x-api-key: Bearer {{auth_token}}
curl -X GET -H "Content-Type: application/json" -H "x-api-key: Bearer {{auth_token}}" "http://robert2-api.dev/api/categories"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive one category with its nested sub-categories
GET /api/categories/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/categories/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a category using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/categories/5 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/categories/5"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a category that was previously soft-deleted.
PUT /api/categories/restore/5 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/categories/restore/5"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Categories are simple entities that allows to tidy up materials. Each category may have several sub-categories.
Just give a name and a valid category ID, and here you go.
POST /api/subcategories HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "speakers",
"category_id": 1
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "speakers",
"category_id": 1
}
' "http://robert2-api.dev/api/subcategories"
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Change the name of a sub-category.
PUT /api/subcategories/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Mixers modified"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"name": "Mixers modified"
}
' "http://robert2-api.dev/api/subcategories/1"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a sub-category using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/subcategories/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/subcategories/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a sub-category that was previously soft-deleted.
PUT /api/subcategories/restore/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/subcategories/restore/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Companies have a name, and a set of other useful informations like address and phone number. They can be linked to Persons.
Give at least the company legal name, and voilà!
POST /api/companies HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"legal_name": "Gniuk Company"
}
curl -X POST -H "Content-Type: application/json" -d '{
"legal_name": "Gniuk Company"
}' "http://robert2-api.dev/api/companies"
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify a company’s informations.
PUT /api/companies/3 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"legal_name": "Modified Company",
"street": "central av. 42",
"postal_code": "5550",
"locality": "Somewhereville",
"country_id": 1
}
curl -X PUT -H "Content-Type: application/json" -d '{
"legal_name": "Modified Company",
"street": "central av. 42",
"postal_code": "5550",
"locality": "Somewhereville",
"country_id": 1
}' "http://robert2-api.dev/api/companies/3"
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the companies in the application, sorted by name, and within pagination.
GET /api/companies HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/companies"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive one company with all its informations.
GET /api/companies/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/companies/1"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the Persons attached to a given company.
GET /api/companies/1/persons HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/companies/1/persons"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Search a company by its legal name.
GET /api/companies/search?legal_name=modif HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/companies/search?legal_name=modif"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a company using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/companies/1 HTTP/1.1
Host: robert2-api.dev
curl -X DELETE "http://robert2-api.dev/api/companies/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a company that was previously soft-deleted.
PUT /api/companies/restore/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/companies/restore/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Events are the main entity of the application. An event is defined by a title, a start date and an end date. An event can contain several Materials, as well as people: Assignees are the workers, and Beneficiaries are the clients (both refer to the ‘Person’ entity).
To create an event, the following fields must be provided:
user_id
title
start_date
end_date
location
POST /api/events HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"user_id": 1,
"title": "Fête de la musique",
"start_date": "2019-06-21 00:00:00",
"end_date": "2019-06-21 23:59:59",
"is_confirmed": true,
"location": "Toulouse - Place du Capitole",
"beneficiaries": [5],
"assignees": [3],
"materials": [
{"id": 3, "quantity": 1},
{"id": 4, "quantity": 5}
]
}
curl -X POST -H "Content-Type: application/json" -d '{
"user_id": 1,
"title": "Fête de la musique",
"start_date": "2019-06-21 00:00:00",
"end_date": "2019-06-21 23:59:59",
"is_confirmed": true,
"location": "Toulouse - Place du Capitole",
"beneficiaries": [5],
"assignees": [3],
"materials": [
{"id": 3, "quantity": 1},
{"id": 4, "quantity": 5}
]
}' "http://robert2-api.dev/api/events"
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 201 Created |
---|---|
Content-Type | application/json |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify an event informations.
PUT /api/events/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"user_id": 2,
"title": "C'est noël",
"start_date": "2018-12-24 00:00:00",
"end_date": "2018-12-25 23:59:59",
"is_confirmed": true,
"location": "Dijon, France",
"beneficiaries": [23, 24],
"assignees": [30, 31],
"materials": [
{"id": 3, "quantity": 1},
{"id": 5, "quantity": 1},
{"id": 7, "quantity": 3}
]
}
curl -X PUT -H "Content-Type: application/json" -d '{
"user_id": 2,
"title": "C'est noël",
"start_date": "2018-12-24 00:00:00",
"end_date": "2018-12-25 23:59:59",
"is_confirmed": true,
"location": "Dijon, France",
"beneficiaries": [23, 24],
"assignees": [30, 31],
"materials": [
{"id": 3, "quantity": 1},
{"id": 5, "quantity": 1},
{"id": 7, "quantity": 3}
]
}' "http://robert2-api.dev/api/events/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the events in the application, sorted by start date, and within pagination.
GET /api/events HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/events"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive one event with all informations: its User and Person creator’s data, all its Materials (with quantity assigned in pivot), and its Assignees and Beneficiaries.
GET /api/events/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/events/1"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive the missing materials for the period of an event. This is usefull to know what materials must be aquired before the event begins.
GET /api/events/6/missing-materials HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/events/6/missing-materials"
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Remove an event using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/events/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/events/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore an event that was previously soft-deleted.
PUT /api/events/restore/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/events/restore/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Materials are the foundation of the application. It’s basically what’s gonna be rented. A material is defined by a name, a rental price and a stock quantity. It belongs to a Park, a Category and an optional Sub category. It can be linked to several Events and Tags.
To create a material, all the following fields are required:
name
reference
description
park_id
category_id
rental_price
stock_quantity
replacement_price
Note that we can create Tags and associate them directly to the newly created material.
POST /api/materials HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Yamaha PM5D",
"reference": "PM5D",
"description": "Big numeric mixing console",
"park_id": 1,
"category_id": 1,
"sub_category_id": 1,
"rental_price": 10,
"stock_quantity": 5,
"replacement_price": 525,
"tags": ["Brand new"]
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "Yamaha PM5D",
"reference": "PM5D",
"description": "Big numeric mixing console",
"park_id": 1,
"category_id": 1,
"sub_category_id": 1,
"rental_price": 10,
"stock_quantity": 5,
"replacement_price": 525,
"tags": ["Brand new"]
}' "http://robert2-api.dev/api/materials"
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 409 Conflict |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify material informations.
PUT /api/materials/4 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Console Yamaha PM5D"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"name": "Console Yamaha PM5D"
}' "http://robert2-api.dev/api/materials/4"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all materials of the application, with their related tags, and custom attributes. The results are paginated, and it’s possible to filter and sort them, as well as apply a search term.
GET /api/materials?whileEvent=1&search=&limit=100&ascending=1&page=1&byColumn=0&orderBy=name&park=1&category=2&subCategory=8&onlySelectedInEvent=1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/materials?whileEvent=1&search=&limit=100&ascending=1&page=1&byColumn=0&orderBy=name&park=1&category=2&subCategory=8&onlySelectedInEvent=1"
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Content-Type | application/json |
|
Retreive one material by its ID, with all its related informations.
GET /api/materials/4 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/materials/4"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive the list of all tags associated to a given material.
GET /api/materials/2/tags HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/materials/2/tags"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a material using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/materials/5 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/materials/5"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a material that was previously soft-deleted.
PUT /api/materials/restore/1 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/materials/restore/1"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
To create a material attribute, the following fields are required:
name
type
(must be one of integer
, float
, string
, or boolean
)The fields unit
and max_length
are optionnal, and the field max_length
is only usefull for string type.
POST /api/attributes HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Poids",
"type": "integer",
"unit": "kg",
"max_length": null
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "Poids",
"type": "integer",
"unit": "kg",
"max_length": null
}' "http://robert2-api.dev/api/attributes"
Status | 401 Unauthorized |
---|---|
Content-Type | application/json |
|
Status | 201 Created |
---|---|
Content-Type | application/json |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json |
|
Retreive all material’s custom attributes. This is usefull to construct a form allowing to edit materials.
GET /api/materials/attributes HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/materials/attributes"
Status | 200 OK |
---|---|
Content-Type | application/json |
|
A Park is basically a set of Materials. It’s defined by just a name. The application must always have at least one park in its database, because all materials necessarily belong to a park.
Just give a name, and park is added!
POST /api/parks HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "New Park"
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "New Park"
}
' "http://robert2-api.dev/api/parks"
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 409 Conflict |
---|---|
Date | Mon, 31 Dec 2018 16:13:57 GMT |
Server | Apache/2.4.29 (Ubuntu) |
Content-Length | 470 |
Keep-Alive | timeout=5, max=99 |
Connection | Keep-Alive |
Content-Type | application/json;charset=utf-8 |
|
Modify a park’s name.
PUT /api/parks/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Modified Park"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"name": "Modified Park"
}
' "http://robert2-api.dev/api/parks/2"
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the parks in the application, sorted by start date, and within pagination.
GET /api/parks HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/parks"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive one park.
GET /api/parks/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/parks/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive the list of all the materials that are associated to the given park.
GET /api/parks/1/materials HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/parks/1/materials"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a park using its ID.
Works in 2 steps:
deleted_at
field with current date and time.WARNING: This will remove all materials associated to the deleted park!
DELETE /api/parks/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/parks/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a park that was previously soft-deleted.
PUT /api/parks/restore/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/parks/restore/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Persons are the people. It may or may not be linked to an User. A person is defined by a first name and a last name, and serveral informations are available, like email, phone number or address.
Persons are mainly used in Events: as Beneficiaries to defined an event’s client, or as Assignees to define the people who will work on an event.
To create a person, the following fields are required:
first_name
last_name
nickname
Note that we can create Tags and associate them directly to the newly created person.
POST /api/persons HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"first_name": "Jean",
"last_name": "Destroy",
"nickname": "to-be-deleted",
"tags": ["Emmerdeur"]
}
curl -X POST -H "Content-Type: application/json" -d '{
"first_name": "Jean",
"last_name": "Destroy",
"nickname": "to-be-deleted",
"tags": ["Emmerdeur"]
}' "http://robert2-api.dev/api/persons"
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify a person’s informations.
PUT /api/persons/3 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"first_name": "Bilbo",
"last_name": "Baggins",
"nickname": "Bilbus"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"first_name": "Bilbo",
"last_name": "Baggins",
"nickname": "Bilbus"
}' "http://robert2-api.dev/api/persons/3"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all persons of the application, sorted by last name, and within pagination.
GET /api/persons HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/persons"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all persons that have a set of tags, sorted by last name, and within pagination.
GET /api/persons?tag[]=customer&tag[]=friend HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/persons?tag[]=customer&tag[]=friend"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all informations of a given person.
GET /api/persons/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/persons/2"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all tags associated to a given person.
GET /api/persons/3/tags HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/persons/3/tags"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a person - Well, hum, just in database, huh? :D - using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/persons/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/persons/2"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a person that was previously soft-deleted.
PUT /api/persons/restore/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/persons/restore/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Tags are a mean to tidy up and sort Materials and Persons. A tag is defined by just a name.
Each Material can have several Tags, and each Tag can have serveral Materials. Same for Persons.
Just send the name of a tag, and that’s it!
POST /api/tags HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Vintage"
}
curl -X POST -H "Content-Type: application/json" -d '{
"name": "Vintage"
}
' "http://robert2-api.dev/api/tags"
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 409 Conflict |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify a tag’s name.
PUT /api/tags/6 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"name": "Just modified Tag"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"name": "Just modified Tag"
}
' "http://robert2-api.dev/api/tags/6"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the tags of the application, sorted by name, and within pagination.
GET /api/tags HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/tags"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the Persons that have the given tag.
GET /api/tags/1/persons HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/tags/1/persons"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive all the Materials that have the given tag.
GET /api/tags/4/materials HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/tags/4/materials"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Search tags by their name.
GET /api/tags/search?name=cli HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/tags/search?name=cli"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a tag using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/tags/6 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/tags/6"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a tag that was previously soft-deleted.
PUT /api/tags/restore/6 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/tags/restore/6"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Users are, well… the users of the application. They are defined by a pseudo, a password, a Group and an email address.
A user can be linked to a Person, in order to provide more informations about her or him.
The Group of an user must be admin
, member
, or visitor
.
Create a user, directly with its associated Person.
POST /api/users/signup HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"pseudo": "newuser",
"email": "newuser@robertmanager.org",
"password": "test",
"group_id": "member",
"person": {
"first_name": "Member",
"last_name": "Test"
}
}
curl -X POST -H "Content-Type: application/json" -d '{
"pseudo": "newuser",
"email": "newuser@robertmanager.org",
"password": "test",
"group_id": "member",
"person": {
"first_name": "Member",
"last_name": "Test"
}
}' "http://robert2-api.dev/api/users/signup"
Status | 201 Created |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify user’s pseudo and associated person’s informations.
PUT /api/users/3 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"pseudo": "tobedeleted",
"person": {
"first_name": "Remove",
"last_name": "Me please"
}
}
curl -X PUT -H "Content-Type: application/json" -d '{
"pseudo": "tobedeleted",
"person": {
"first_name": "Remove",
"last_name": "Me please"
}
}' "http://robert2-api.dev/api/users/3"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json;charset=utf-8 |
|
This is the exact same endpoint as the AUTH - Token one.
Same payload, same result: give a username and password, and get your access token for the session. For example of responses, see AUTH - Token request documentation.
POST /api/users/signin HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"identifier": "admin",
"password" : "admin"
}
curl -X POST -H "Content-Type: application/json" -d '{
"identifier": "admin",
"password" : "admin"
}' "http://robert2-api.dev/api/users/signin"
Status | 404 Not Found |
---|---|
Content-Type | application/json |
|
Status | 200 OK |
---|---|
Cache-Control | private, no-cache |
Content-Type | application/json |
|
Status | 400 Bad Request |
---|---|
Content-Type | application/json |
|
Retreive all users of the application, with their associated Persons, sorted by pseudo, and within pagination.
GET /api/users HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/users"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Retreive one user with its associated Person.
GET /api/users/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/users/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Get a user’s settings data.
GET /api/users/1/settings HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X GET -H "Content-Type: application/json" "http://robert2-api.dev/api/users/1/settings"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Modify a user’s settings data.
PUT /api/users/1/settings HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
{
"language": "FR"
}
curl -X PUT -H "Content-Type: application/json" -d '{
"language": "FR"
}' "http://robert2-api.dev/api/users/1/settings"
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Remove a tag using its ID.
Works in 2 steps:
deleted_at
field with current date and time.DELETE /api/users/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X DELETE -H "Content-Type: application/json" "http://robert2-api.dev/api/users/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Restore a user that was previously soft-deleted.
PUT /api/users/restore/2 HTTP/1.1
Host: robert2-api.dev
Content-Type: application/json
curl -X PUT -H "Content-Type: application/json" "http://robert2-api.dev/api/users/restore/2"
Status | 200 OK |
---|---|
Content-Type | application/json;charset=utf-8 |
|
Status | 404 Not Found |
---|---|
Content-Type | application/json;charset=utf-8 |
|