Calling Mashape APIs in Node.js through REST

UPDATE (Oct 28, 2013): The post below is already outdated.  To consume Mashape APIs through node.js, we recommend that you use Unirest for node.js

UPDATE (Feb 27, 2013):  Please note that we have improved the way authentication keys are handled in Mashape.  The header value below will be replaced by either the new Testing or Production Keys.  Read this post to learn more.

Hi guys, here’s a short example on how you can call APIs in Mashape through Node.js / REST.  It’s pretty straightforward. You just need to remember that you need to make a secure call using https://, and have a generated Mashape Authorization header and plug it in the header parameter.

Mashape Nodejs

 

(You can download this source code from Github)

And then run the node.js script like this:

Mashape Nodjs output

You would get a nice JSON reply that you can start parsing.

If you’re new to Node.js, you can check out their site at http://nodejs.org. You can get either the source code or binaries for Node.js there.

We’d like to invite node.js developers out there to share with us any applications that you are planning/or have created using the APIs in Mashape.  There are tons of APIs to try!  You can head over to our Facebook page if you have questions.

Happy coding!

UNIREST FOR NODE.JS

About

Mashape is the largest API hub in the world where you can consume, distribute, monitor and monetize your public and private APIs. Mashape powers 10,000 public & private APIs in every major industry, including finance, healthcare, and entertainment. We’re a Series A startup backed by Jeff Bezos (Amazon), Eric Schmidt (Google), Stanford University and top tier VC firms including Index Ventures, NEA and CRV.

Introducing API Glossary by Mashape

  When it comes to APIs, there’s a lot of jargon out there. The meaning of certain terms isn’t always obvious, and API providers sometimes use different ones to

Using Unirest (Java) for your Android projects

This post will show you how to get Unirest-java running on your Android projects.  Unirest is a lightweight HTTP client library with port available in many languages. This is a

Installing unirest-java with the Maven Assembly Plugin

Managing dependencies for your Java applications is difficult, unless you have Maven!  Maven is an Apache build manager for Java projects.  In this post, we will use a Maven

30+ ways to make REST calls in Node.js, PHP, Python, Rails, Obj-C, .NET, and Java / Android

Here’s a list of resources on how to make REST calls in different languages.  (We also have this list of 40+ tutorials on how to create an API in