Call to display ideas with a certain status
- 7 years ago
Hi kgroneman
Correct me if I am wrong. After reading over your post a few times, I think you are asking that you want an API v1 or v2 query that can pull ideas that have statuses that may or may not be completed but have a different status key.
From that assumption you would be looking for something like the API v2 call below:
SELECT * FROM messages WHERE conversation.style IN('idea') AND depth=0 AND status.key='accepted'
The conversation style can be written like above or conversation.style='idea'.
depth=0 means that only the idea (topic) itself is checked against the criteria.
status.key='accepted' can be customised to the specific status key that you want to get. In your case, you would want to use something like the following:
- status.key='delivered'
- status.key='declined'
- status.key='arichived'
- status.key='agent'
Unfortunately, you are unable to get multiple status keys at once. You can, however, may multiple calls using something like below:
<#assign statuses = ['status1', 'status2', 'status3', 'status4', 'statusN'] > <#assign apiResults = [] > <#list statuses as status > <#assign apiQuery = "SELECT * FROM messages WHERE conversation.style='idea' AND depth=0 AND status.key='" + status + "'" > <#assign apiResults += rest('2.0','/search?q=' + (apiQuery)?url ) > </#list>
Then if you would like to get the results with status.completed=true add the following code:
<#assign filteredResults = [] > <#list apiResults as idea > <#if idea.status.completed > <#-- if status.completed == true --> <#assign filteredResults += idea > </#if> </#list>
Relevant Links:
API V2 - messages