Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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?

share|improve this question
    
By "...show the skills...", do you mean display the tags? Are you referring to the tag text entry box on the "Ask Question" page? –  Nathan Osman Sep 28 '11 at 17:49
    
Yes... i want to get the tags(skills) from stack overflow –  guna Samba Sep 29 '11 at 17:15
add comment

1 Answer 1

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):

http://api.stackoverflow.com/1.1/tags

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:

http://api.stackoverflow.com/1.1/tags?filter=vb

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:

http://api.stackoverflow.com/1.1/tags/perl/wikis

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:

http://api.stackoverflow.com/1.1/tags/perl;python/wikis

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:

  1. Load all tags for the site filtered by the string the user has entered.
  2. Combine the returned list of tags with a semicolon and hit the /tags/.../wikis route.
  3. Now present the tags and descriptions to the user.
share|improve this answer
    
thanks for your input George... I hope this API URL has to be called using JScript + JSON (any methods)... am expecting specifically that exmaple "Call to Stack API from Jquery to get the list of Tags".. –  guna Samba Sep 30 '11 at 16:10
    
@gunaSamba: Yes, all of the API URLs above can be accessed using JSONP. –  Nathan Osman Sep 30 '11 at 17:08
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .