When new vehicle attribute is created in Fleet Organizer, the value is initially empty. We cannot query that attribute data through API call to modify it (to add value to attribute of specific vehicle).
When we call vehicle attribute with name or id in API call, the response does not include vehicles associated with that attribute and we cannot edit the code every time a new attribute is being created for searching with attribute name.
(
https://api.pantaris.io/v2/vehicle-attributes/search with {
"limit":1000,
"query": {
"name": {
"_eq": "width"
}
}
}
the response is:{
"data": [
{
"id": "057b5ffc-a859-11ed-95a1-27698a2e18b4"
}
],
"meta": {
"resultCount": 1
}
}
)
(https://api.pantaris.io/v2/vehicles/_/attributes/search
{
"limit":1000,
"query": {
"id": {
"_eq": "057b5ffc-a859-11ed-95a1-27698a2e18b4"
}
}
}
the response is :
{
"data": [
{
"id": "e984f2b8-a85d-11ed-af3c-a7c95d5cf853"
}
],
"meta": {
"resultCount": 1
}
}
)
Hi, your body is missing the inlineData
parameter. You can read more about it in the API documentation. In addition tolimit
and query
add inlineData: true
. Another approach is to take the ID from your response and make a GET request.
Hi, Thank you for the reply, i have added inlineData parameter and in response we get data of only those vehicles in which vehicle attribute has value (which is manually entered in fleet organizer), there are other vehicles in which vehicle attribute speed is present but no value.
Is there any way to access those vehicle attributes which have no value in other vehicles?
https://api.pantaris.io/v2/vehicles/_/attributes/search
{
"limit":1000,
"query": {
"id": {
"_eq": "057b5ffc-a859-11ed-95a1-27698a2e18b4"
}
},
"inlineData":true
}
{
(
"data": [
{
"id": "6c4822c8-a7c4-11ed-b2c1-ef30f3eb65d4",
"project": {
"_relType": "projects",
"id": "10694cf0-f1bb-11ea-9fc1-d760622f13b8"
},
"name": "speed",
"type": "FLOAT",
"valueEnum": null,
"valueUnit": "km/h",
"valueMin": null,
"valueMax": null,
"isPinned": false,
"tags": null,
"group": null,
"groupSortIndex": 1,
"vehicleGroups": [
{
"_relType": "vehicle-attribute-vehicle-groups",
"_relId": "6c5752d4-a7c4-11ed-8be0-0f80add90911",
"isPinned": false,
"id": "98b86e4c-a14a-11ed-af2a-5f30e91b7826"
}
],
"vehicles": [
{
"_relType": "vehicles",
"_relId": "790cf01a-a7c4-11ed-94b3-239efdd3de66",
"id": "013149c6-188e-11ed-b9b9-3b35137f1e10"
}
],
"createdBy": {
"_relType": "users",
"id": "cdedbec6-5ac5-11ed-91a8-bf14038ccdfb"
},
"createdAt": "2023-02-08T15:22:39.042Z",
"updatedAt": "2023-02-08T15:22:39.042Z"
}
]
})
you could use this list of vehicles, which have a value and send a request to vehicles/search
and exlude them via { id: { _nin: listOfIds } }
Thank you for the reply. sorry for the late response.
I get the response data of the other vehicles in the project. but I need the “_relId” of the empty attribute of the particular vehicle to modify the value of that empty attribute which is not present in the data.
There is no _relId
, when there is no relation. Create one (via POST /vehicles/{vehicleId}/attributes
)
okay, thank you. That is a long process but it is working.