I have a requirement in my application to show the technical skills (tags) in auto-complete format like Stack Overflow has.
Is there any example to get the tags from Stack Overflow using JavaScript + JSON?
I have a requirement in my application to show the technical skills (tags) in auto-complete format like Stack Overflow has.
Is there any example to get the tags from Stack Overflow using JavaScript + JSON?
Based on the information you've provided in your comment - I will now provide an example of how you might accomplish what you're looking to do.
The tags can be retrieved from the API using the /tags
route - a sample request for Stack Overflow looks something like this (notice the results are paginated - you will receive the first 30 tags according to the default sorting method):
Now for auto-completion, you will need to make use of one of the parameters to the /tags
route: filter
. The filter is a query string parameter that causes the /tags
route to return only the tags that contain the provided string. For example, to get all tags that contain the string 'vb', you would issue the following request:
Notice that there are far fewer tags returned. Also notice that every single one of them contains the string 'vb' somewhere in the name. In order to create a tag autocompletion text box like the one on the sites themselves, you will need one more piece of information: the description for the tag.
Fortunately, this is easy to - it's provided in the Tag Wiki route. Here is an example that fetches the tag wiki for Perl:
In the response, you will find an entry 'wiki_excerpt'
- this can be used for the tag description. To get the wiki for multiple tags, just separate them with a semicolon:
Now you have all of the pieces needed to re-implement the tag autocomplete you see on the Stack Exchange sites. When the user enters tags:
/tags/.../wikis
route.