Scenario: Let’s say I have a vehicle with an attribute called speed
and a value 200
. I would like to use the search endpoint to find that vehicle. Therefor I use a POST request to the endpoint above and provide the following search query object.
Parts of the vehicle data model
{
"_relType": "vehicle-attributes",
"_relId": "bafa6dc6-94fe-11ea-abf6-dbc1c2dd4114",
"id": "a5b6ffbe-8ebf-11ea-b301-bb2fc13cffd2",
"value": "2.207"
},
{
"_relType": "vehicle-attributes",
"_relId": "bb04f21e-94fe-11ea-b76e-87c5abfc603f",
"id": "a76bacb0-8eb5-11ea-b7a4-c7874e03d996",
"value": "4268"
},
Doing a get request on one of them results in:
Response from GET request
[ { id: ‘a76bacb0-8eb5-11ea-b7a4-c7874e03d996’,
project:
{ _relType: ‘projects’,
id: ‘c55b8eb4-8944-11ea-8325-bbd291a18fc4’ },
name: ‘02_Vehicle length [mm]’,
isPinned: false,
group:
{ _relType: ‘vehicle-attribute-groups’,
id: ‘7b72dbc6-89ea-11ea-b5c7-1b0d030e53d9’ },
vehicles: [ [Object], [Object], [Object], [Object], [Object] ],
createdBy:
{ _relType: ‘users’,
id: ‘a52ca566-719d-11e9-9732-5bd1411d2d88’ },
createdAt: ‘2020-05-05T09:49:03.728Z’,
updatedAt: ‘2020-05-05T09:49:03.728Z’ } ]
If I try the get values using the SEARCH endpoint it fails:
Failing query object
const FILTER_ATTRIBUTES = {
query: {
value: { _gt: 4 },
},
limit: 20,
};
Error response
response:
{ error:
{ status: 400,
code: 'QUERY_VALIDATION_FAILED',
title: 'Query validation failed',
detail: 'Query validation failed' } } }
Error: Failed to filter vehicle attributes
at getVehicleData ()
By looking to my GET response I see that my model doesn’t contain a value
in it’s model. First of all it would be nice to receive more details about what makes the request fail. So I’ll use the name
attribute next and it will always return an empty array []
Working query object
const FILTER_ATTRIBUTES = {
query: {
name: { _like: '%0%' },
},
limit: 20,
};
Knowing from above that the name is something like ‘02_’ a tried to play around using ‘project.id’ {_eq: myProjectId` but no matter what I try I receive an empty array.
Appreciate support here