To read boats the technical user needs the permission Vessels → Read; to create them, Vessels → Create. Roles are assigned as in How to create a role and a user; the technical user and the key are in Technical users and API keys: connecting an integration.
The endpoint for boats is:
/rest/v1/vector
Check whether a boat exists by its plate
GET /rest/v1/vector?filter=[{"property":"barca_targa","operator":"=","value":"12345-XYZ"}]To search a customer's boats:
GET /rest/v1/vector?filter=[{"property":"barca_proprietario","operator":"=","value":"1234"}]To search by name as well, add a second filter on barca_nome.
The fields of a boat are written, and used in filters, with the column name (barca_nome, barca_targa, barca_proprietario, barca_lunghezza, barca_larghezza); the response returns them with different names (name, plate, customer_id, length).
The response contains the list of boats found, each with all the available fields:
{
"success": true,
"message": "Record(s) Found",
"data": {
"totalCount": 1,
"vector": [
{
...
"id": "9876",
"name": "Barca nome",
"length": "21.6",
"plate": "12345-XYZ",
...
}
]
}
}Creating a boat
POST /rest/v1/vector
In the body of the request you write the boat's data as a JSON "key":"value" string
To assign the boat directly to a customer you must set the "barca_proprietario" field to the ID of the customer the boat is assigned to.
For example
{
"barca_proprietario": 1234,
"barca_nome": "Catamarano di esempio",
"barca_targa": "98765-ABC",
"type_id": 3
}The response contains the boat just created, with all the available fields ("message": "Record Created"):
{
"success": true,
"message": "Record Created",
"data": {
"totalCount": 1,
"vector": {
...
"id": "9876",
"name": "Catamarano di esempio",
"plate": "98765-ABC",
...
}
}
}The "id" field is the one you will then use for further operations on the boat. The type ID (type_id) is read with the Vessel types API.
