Contact Us 1-800-596-4880

Run This Example

API Notebook reached its End of Life in August 2021.

Run This Example

Notebooks are a way to create tutorials and examples with runnable code samples.

What do notebooks look like? You’re reading one right now.

// Run this code by pushing the play button.
// Or you can edit it.
demo = ['great', 'interactive'];
'Notebooks are a ' + demo[0] + ' way to create ' + demo[1] + ' tutorials.';

Notebooks are also a powerful way to explore APIs. When you import a RAML file you can explore an API’s endpoints, make requests (even with OAuth), and view the response.

Here’s an example of a very simple API:

// Import a simple (and fictional) Songs API:
API.createClient('songs', 'https://anypoint.mulesoft.com/apiplatform/repository/v2/organizations/38f6c050-2ea4-409a-949a-adf91c3c5de2/public/apis/179375683/versions/11935560/files/songs.raml');
// Explore the API with typeahead: add a "." after 'songs'
songs

The typeahead reveals that "albums", "artists", and "songs" are available. Let’s access a particular song:

// The song's details will be in the response body.
songs.songs.songId('3').get();

Explore the API on your own by changing the code above, or try our examples for Github, Instagram, or Twitter.

Please read our API Guide for details about using APIs with the Notebook. Want to explore your own API? Create a RAML file.