Skills in SUSI.AI were displayed in a random order earlier as per the response received from the server. To provide more flexibility to the users, the skills can be sorted by various orders like top-rated, lexicographical, recently updated and so on. This blog shows how to get sorted skills from the server using the getSkillList.json API.
For requesting a list of SUSI skills, the endpoint used is /cms/getSkillList.json.
This will give you the sorted skills as per the applied filter. Some of the filters include top rated skills, recently updated skills, newly created skills, etc.
Base URL : https://api.susi.ai/cms/getSkillList.json
Parameters to be passed :
- group – This is the group to which a skill belongs to.
- language – The language in which the skill is needed.
- applyFilter – This parameter tells if the filtering needs to be enabled.
- filter_type – This is the order in which the skills need to be sorted and is applicable if applyFilter is true.
- filter_name – This tells whether the order of sorting needs to be ascending or descending and is applicable if applyFilter is true.
Currently, there are following filters available :
- Top Rated : The skills will be sorted based on the skills ratings by users.
- Lexicographical : The skills will be sorted in alphabetical order.
- Newly Created : The skills will be displayed based on the date of creation.
- Recently Updated : The skills will be sorted based on the date when they were last updated.
- Feedback Count : The skills will be sorted as per the feedback count.
- This Week Usage : The skills will be sorted as per the usage analytics of the week.
- This Week Usage : The skills will be sorted as per the usage analytics for the last 30 days.
Note: In all the above cases, the ‘applyFilter’ param will be passed with the value ‘true’ otherwise the skills will not be sorted.
Here is an example of a URL for displaying the top rated skills:
To make a request to the getSkillList.json API, make a GET request as follows :
Here the query map contains all the aforementioned params.
Now, make the GET request using Retrofit from the model :
The skills in the filteredData array, received in the JSON response, shall be sorted in the order based on the filter_type and filter_name params that you passed. Now, this array can be used to display skills on the skills listing page.
- Check out the ListSKillsService.java to know more about the API –
- Check out a blog on how Kotlin is a great language for JSON –