2018-09-05

Meteor - How to make an HTTP call to Wikipedia's REST API

HTTP.call( 'GET', 'https://en.wikipedia.org/api/rest_v1/page/summary/Jane_Austen', {
  params: {
    "User-Agent": "your@email.com"
    , "Accept": "application/json"
    , "charset": "utf-8"
    , "profile" : "https://www.mediawiki.org/wiki/Specs/Summary/1.3.7"
  }
}, function( error, response ) {
  if ( error ) {
    console.log( error );
  } else {
    console.log( response.data );
  }
});

No comments:

Post a Comment