Mashape Updates #9 – Added Erlang Clients

Mashape updates

Stormtroopers working on Mashape updates
Image credit: https://flic.kr/p/8ueZ5r

Mashape now auto-generates Erlang clients for all APIs!

Similar to other supported languages, the clients provide both synchronous and asynchronous requests. For the Erlang clients, you can provide either a function to be run on completion of the request or a Pid for a process that will send the result of the request upon completion.

Downloading a client comes with all the necessary Erlang dependencies to get started - ibrowsemochiweb, as well as the Mashape Erlang application emashape which is the core common functionality between all Erlang Mashape clients. They also come with both a sinan and rebar config for easy use with either Erlang build tool.

Let’s look at an example of the client in action. We’ll use the Chatterbox API for this example.

setup(PublicKey, PrivateKey) ->  
classifytext(Lang, Text) ->
classifytext(Lang, Text, Optional) when is_list(Optional) ->
classifytext(Lang, Text, Callback) ->
classifytext(Lang, Text, Optional, Callback) ->

The setup/2 function takes your Mashape public and private key, starts required dependencies and creates a new process for handling required state for making requests. For this client, we have only one endpoint to make requests to, but multiple definitions. The classifytext function can be as simple as the first definition, where you provide only the language of the text and the text itself, and returns the classification. The other three allows for optional paramters, a callback or both. Optional parameters for the request must be passed as a proplist. In this case the only optional parameter is ‘exclude’, so it would look like: [{“exclude”, “value”}].

You can get the core application, emashape, on github: http://github.com/Mashape/mashape-erlang-client-library/

Installing the Mashape application to your lib directory simplifies the use of the clients. You can install it by copying lib/emashape-* and the contents of deps/ to the lib of your Erlang install, example /usr/local/erlang/lib/.

CONSUME API NOW

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

OpenSSL Update – Mashape not vulnerable to Heartbleed

On Monday April 7th OpenSSL released an update to address CVE-2014-0160 (aka Heartbleed). This was a vulnerability in the popular cryptographic library that is used to secure many major

Mashape Revenue Share Fees Down 5%. Effective now!

Hello Mashape community, We’re happy to announce a reduced revenue share percentage rate. Going forward monetized APIs will only be charged a 20% revenue share. With ❤. As always, Mashape

Announcing The World’s Largest API Directory – PublicAPIs.com

We know how hard it is to find great APIs. So we built PublicAPIs.com, an API directory where you can instantly search through thousands of APIs and discover public cloud web services. Here’s