I want to make an api call and need to use a query. You guys provide an example, which is “project.id”, but I could not find any other possibilities. More specifically, I am looking for “application.id” and “version.id”.
Is there an overview for all possible fields or something alike?
For a specific search endpoint like e.g. /vehicles/search
you have the props of the vehicle defined in the GET
request like e.g. here
{
"id": "9d1c6235-aa49-41e8-b27a-79143917bcb0",
"project": {
"_relType": "projects",
"id": "97369a05-911e-4dbb-bfa8-c47820d809a4"
},
"assetDirectory": {
"_relType": "directories",
"id": "97369a05-911e-4dbb-bfa8-c47820d809a4"
},
"name": "Holiday Ride",
"group": {
"_relType": "vehicle-groups",
"id": "97369a05-911e-4dbb-bfa8-c47820d809a4"
},
"attachedToVehicle": {
"_relType": "vehicles",
"id": "ec958eef-6353-4a89-b240-19b056ef87b7"
},
"type": "CAR",
"licencePlate": "ST 12345",
"image": {
"_relType": "files",
"id": "97369a05-911e-4dbb-bfa8-c47820d809a4"
},
"chassisNumber": "1337999",
"color": "#FF0012",
"distinctionColor": "red",
"manufacturer": "Porsche",
"model": "911",
"responsible": "Bob Bobbington (BEG)",
"engineType": "ELECTRIC",
"enginePower": "123",
"enginePowerUnit": "kW",
"manufactureYear": "2011",
"manufactureMonth": 11,
"locationLatitude": 48.775846,
"locationLongitude": 9.182932,
"locationName": "Ehningen Garage 3",
"locationAddress": "Robert-Bosch-Allee 1, 74232 Abstatt",
"locationUpdatedAt": "2018-04-11T17:32:14.831Z",
"bookingStatus": "AVAILABLE",
"registeredAs": "SERIES_VEHICLE",
"testArea": "Lighting systems",
"price": 19999.99,
"category": "C2",
"beNumber": "OX1203957",
"weeklyReport": false,
"comments": [
{
"_relType": "comments",
"id": "97369a05-911e-4dbb-bfa8-c47820d809a4"
}
],
"bookings": [
{
"_relType": "vehicle-bookings",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"links": [
{
"_relType": "external-links",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"attributes": [
{
"_relType": "vehicle-attributes",
"_relId": "df353864-b42f-4ec0-abd6-102f185cba5b",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6",
"value": "Green"
}
],
"files": [
{
"_relType": "files",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"fileSize": 31981,
"devices": [
{
"_relType": "devices",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"attachedVehicles": [
{
"_relType": "vehicles",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"tasks": [
{
"_relType": "tasks",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"versions": [
{
"_relType": "versions",
"id": "6fe49284-7b0e-486f-a117-40b393aaf1c6"
}
],
"createdBy": {
"_relType": "users",
"id": "ec958eef-6353-4a89-b240-19b056ef87b7"
},
"createdAt": "2018-04-11T17:32:14.831Z",
"updatedAt": "2018-04-11T17:32:14.831Z"
}
There you can see you can search for "id"
, "name"
, "project.id"
, "image.id"
, "group.id"
, "manufactureYear"
, etc.
So in your query you can use e.g. (here we use /vehicles/search
):
{
"query": {
"group.id": { "_eq": "97369a05-911e-4dbb-bfa8-c47820d809a4" },
}
}
For second level dependencies this is a little bit more tricky (here we use /devices/search
):
{
"query": {
"_or": [
{ "_rel": { "vehicle": { "name": { _like: `%test%` } } } },
{ "_rel": { "group": { "name": { _like: `%test%` } } } }
]
}
}
I hope it helps!
Hi Hans,
now it is clear! Thanks for the good explanation
Florian
1 Like