Skip to content
kgangadhar edited this page May 25, 2019 · 1 revision

stack-exchange

NPM

The stack-exchange is a simple npm module that provides a wrapper to access StackOverflow API endpoint.

Build Status npm version Node.js Version Known Vulnerabilities

Installation

Installation is done using the npm install command:

$ npm install stack-exchange

Quick Start

You can make 300 requests without a key per day, with a key you can make 10,000 requests. To generate key visit here.The sections are as follows

For more details about the endpoints on each section visit table-of-content. To use above mentioned sections endpoints, you need to create their respective sections objects as follows:

// You can specify the version of api you want to use by passing object with version field.
// if version is not provided, by default api response with version 2.2 will be provided 
 
const stackexchange  = require("stack-exchange")({ version : "2.2" });
 
const stack_users = stackexchange.users;//for users sections endpoints
const stack_me = stackexchange.me;//for me sections endpoints
const stack_questions = stackexchange.questions; //for questions sections endpoints
const stack_answers = stackexchange.answers; //for answers sections endpoints
const stack_badges = stackexchange.badges; //for badges sections endpoints
const stack_tags = stackexchange.tags; //for tags sections endpoints
const stack_comments = stackexchange.comments;//for comments sections endpoints
const stack_posts = stackexchange.posts;//for posts sections endpoints
const stack_search = stackexchange.search;//for search sections endpoints
const stack_suggested_edits = stackexchange.suggested_edits;//for suggested_edits sections endpoints
const stack_network = stackexchange.network;//for network sections endpoints
const stack_info = stackexchange.info; //for info sections endpoints
const stack_privilages = stackexchange.privilages; //for privilages sections endpoints
const stack_revisions = stackexchange.revisions; //for revisions sections endpoints
const stack_events = stackexchange.events; //for events sections endpoints
Clone this wiki locally