I’m replying to myself because I get mail from the mailinglist but replying to it doesn’t show up over here and other replies don’t show here either, weird.
On 28-11-2020 19:39, knation via Request Tracker Community Forum wrote:
knation
November 28
You should be able to use the asset query builder web UI to build your query and then provide that to the REST2 interface
Assets search does not accept ticketSQL according to the docs on bestpractical.com only the json syntax. I tried several incantation and location but can’t get anything useful from it.
This is wat the Advanced search show: Catalog = ‘Klant’ AND CF.{CPU} LIKE ‘Core 1’ and it returns 1 asset, number 3
This is what I think the json body should be (this returns all assets in Catalog 2):
[
{
“field”: “Catalog”,
“value”: “2”
}
]
Extending it to:
[
{
“field”: “Catalog”,
“value”: “2”
},
{
“field”: “CPU”,
“value”: “Core 1”,
“entry_aggregator”: “AND”
}
]
Should show asset number 3 but it shows all 3 assets that are in Catalog 3. CPU is a customfield
The following shows asset 3:
[
{
“field”: “Catalog”,
“value”: “2”
},
{
“field”: “id”,
“value”: “3”,
“entry_aggregator”: “AND”
}
]
Just to show the other options I’ll past the curl command that Insomnia generates, this one works, see above.
curl --request POST
–url ‘https://rt.example.com/REST/2.0/assets/?token=1-14-abcdefghijklmn&=’
–header ‘Content-Type: application/json’
–data ‘[
{
“field”: “Catalog”,
“value”: “2”
},
{
“field”: “id”,
“value”: “3”,
“entry_aggregator”: “AND”
}
]’
And this one doesn’t, show all 3 assets in Catalog 2
curl --request POST
–url ‘https://rt.example.com/REST/2.0/assets/?token=1-14-abcdefghijklmn&=’
–header ‘Content-Type: application/json’
–data ‘[
{
“field”: “Catalog”,
“value”: “2”
},
{
“field”: “CPU”,
“value”: “Core 1”,
“entry_aggregator”: “AND”
}
]’
Thanks,
Joop