Join For Free

How to integrate Mashape APIs with Parse as Cloud Modules @ParseIt Posted 5 months ago

image

Photo credit: Parse

Parse is a backend-as-a-service (BAAS) platform that lets you focus on building your applications without worrying about server and infrastructure maintenance and complexities.  If you haven’t heard or tried Parse before, I encourage you to try their Quickstart here to get an idea of how the BAAS paradigm works.

This post shows an example of a Mashape API integrated with Parse through Parse Modules.  Parse Modules are libraries that Parse developers import into their app to use certain functionality offered by 3rd-party APIs.  Once your API is turned into a Parse Module, it will be easier for developers to use it in their applications.

There’s a whole tutorial from the Parse documentation that shows how to turn your APIs into Cloud Modules, so we won’t go through those steps.  Instead we will show a finished working code here, that you can use to pattern your Modules after.  (It is however essential to have an understanding of how Cloud Code and Cloud Modules work, so reading them first would be great).

Let’s get started!

This is a very simple representation of how each component interacts with one  another.  (Although we are using HTML and Javascript for our app, you can access the Cloud Code from any language supported by Parse).  For this project, we will integrate the Yoda Speak API to Parse as a Cloud Module.

image

1.  Application (index.html) initializes the Parse Javascript SDK and calls our Cloud Code “yodaSpeakFunction”:

2. Define the Cloud Code “yodaSpeakFunction” (main.js in the /cloud folder) and initialize/call the Cloud Module “yodaSpeak”:

3. The Cloud Module “yodaSpeak” (yoda-1.0.0.js in the /cloud folder) where the Mashape API is called

Our Parse Cloud Module ‘yoda-1.0.0.js' is now finished! You can drop it in your own Parse Cloud Code and start using it.

What’s next?

There’s a ton more Mashape APIs there to expose as Parse libraries.  Let me know if you’ve turned your API to a Parse Cloud Module so we can gather them here and promote them to other developers! - chris@mashape.com



  1. mashape posted this