API for "Filter Results" for Training section.

68 views
Skip to first unread message

tech...@gmail.com

unread,
Nov 13, 2017, 11:51:13 AM11/13/17
to ReliefWeb API Developers
I wanted to ask if there is any API available for the list of "Filter Results" as shown in the screenshot ? I can get the list of countries, theme, cost etc but can I get the list of all filters/facets using the API? 

Thank you,
Vijeta
Capture.PNG

Miguel Hernandez

unread,
Nov 13, 2017, 12:33:52 PM11/13/17
to ReliefWeb API Developers
Dear Vijeta,

The list of facets for each content type (or endpoint) can be found at the end of the API documentation (http://apidoc.rwlabs.org/#fields-tables). The fields that act as facets (or filters) have the "facetable" attribute.

I think that you are asking for the list of facets for training, so you can search for them in the Training tab.

After that, you can use the facet parameter to get all the values of a certain facet (or filter name. Here is an example for getting 20 countries for training: https://api.reliefweb.int/v1/training?appname=sample&facets[0][field]=country&facets[0][limit]=20&limit=0 . For more information see the "facet" section in the API documentation (http://apidoc.rwlabs.org/#facet).

Hope this solves your question.

Best,
Miguel

tech...@gmail.com

unread,
Nov 13, 2017, 12:39:46 PM11/13/17
to ReliefWeb API Developers
Thank you for your quick response Miguel. Yes, I am asking for the list of facets of training. I was hoping to get that list from API so that I don't have to hard code the facets in the app. 

The facet API is only helpful for a particular facet. Are there any plans of developing API for the list of all available facets? 

Miguel Hernandez

unread,
Nov 14, 2017, 12:22:09 PM11/14/17
to ReliefWeb API Developers
Hi Vijeta,

Some of the facets are available at this endpoint: https://api.reliefweb.int/v1/references
This endpoint is intended to provide an easy way to access ReliefWeb "standardized" taxonomies, so it doesn't provide all the facets.
Depending on the facets you want to use, this can help you to automate.
For the complete list, you should look for them manually from the APIDoc. 

Regarding your comment that the facet API is only helpful for a particular facet, you can use the facet parameter multiple times to query different facets, look at this example from the APIDoc:

Reply all
Reply to author
Forward
0 new messages