REST API selectQuery - Filtering Results

Posted by Rollbase User on 25-Mar-2013 16:09

How would you enter a URL string if I wanted to filter only certain items? For example, if I entered the following URL: rollbase.com/rest/api/selectQuery?query=SELECT status FROM client&sessionId=rest-3039620713623997054 I would get all the clients with all statuses listed. Now, Lets say I want to filter and view only the "SALE" and "CLOSED" statuses on these clients, how would I enter the URL in that case?

All Replies

Posted by Admin on 25-Mar-2013 19:46

Hi Bob,



The REST API selectQuery call expects a URL encoded value as query parameter, so your above example would not work as shown. I recommend using the JavaScript encodeURIComponent() method to encode the whole query parameter before making it part of the URL. You can do a Google search on encodeURIComponent to find out more about this native JS function.



The query parameter supports all types of queries that the Rollbase Query API supports. For more details on the Query API, see the section called "Query API" in Chapter 6 of Rollbase In Action:

https://www.rollbase.com/rollbaseinaction.shtml



Hope this helps,

Matt

This thread is closed