Discussions
/api/QueryDefinition/_execute - GetRestAccess ... results
Trying to use /api/QueryDefinition/_execute with the GetRestAccess option. (First off, shout out to Moli for the reminder that the documentation is (still) wrong.) The response, while technically complete and correct, includes the results in an overly complex/verbose format. I (assume) the endpoint is to check the setting for the "Available via REST API" checkbox, at least that's what I'm using it for, and I would expect a response to include (somewhere) a simple yes/no, true/false, 1/0 etc. Instead the result is:
{
"Result": {
"$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib",
"$values": [
"'$/ContactManagement/DefaultSystem/Queries/Invoice Tab Button' REST access set to 'False'"
]
}
}
I realize it's probably like this because you can use (actually you have to) the payload to check for multiple queries, when you do that the response is something like:
{
"Result": {
"$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib",
"$values": [
"'$/ContactManagement/DefaultSystem/Queries/Invoice Tab Button' REST access set to 'False'",
"'$/ContactManagement/DefaultSystem/Queries/Event Tab Button' REST access set to 'False'"
]
}
}
In order to get the results, you have to loop thru the array and do some string manipulation to get the response out. It would make so much more sense to return it in something like:
{
"Result": {
"$type": "System.Collections.Generic.List`1[[System.String, mscorlib]], mscorlib",
"$queries": [
{
"$/ContactManagement/DefaultSystem/Queries/Invoice Tab Button": false
},
{
"$/ContactManagement/DefaultSystem/Queries/Event Tab Button": false
}
]
}
}
Longer? Yes. Still need to parse thru it? Yes. No need for string manipulation though.
I'm still not sure where to send comments like this. IMO they don't belong in enhancements and sending them to tech support doesn't seem right either (other than the documentation issue). I also realize it's Friday and it's minimal and irrelevant but hey ... is what it is. Thanks.