Languages Magazine

The MindMeld API: Introducing the Explorer

By Expectlabs @ExpectLabs

Explore the multiple ways you can use our API Explorer to experiment with all of the endpoints available on the MindMeld platform. 

Continue your MindMeld education with this video that explains how to navigate the management console, our API’s main hub.

TRANSCRIPT:

In this video, I will show you how to use the MindMeld API Explorer, which is a powerful tool that lets developers explore and visualize the data that’s available in all of the endpoints supported by the MindMeld API. To get to the Explorer, start in your developer console, and select the app that you’d like to begin exploring. Then click the button that says “Launch API Explorer.” That will take you to our browser-based tool where you can then begin sending data to the MindMeld API and view the data that is returned.

What’s in this Explorer? Let’s start in the upper right-hand corner with the token area. When the tool first loads, you should see it already populated with an admin token. As explained in the documentation, there are two kinds of tokens: there’s an admin token that’s used for developers to get access to all the information in your application, and there are also user tokens, which are assigned to users of your application that are designed to be more secure. If you click on either the user token refresh button or the app token refresh button, you can reload a new token and revoke any previous tokens that you might have. Currently the API Explorer uses Facebook authentication for the user token, but future versions will have different authentication mechanisms.

Now on the left-hand column of the Explorer, this is where we list all of the API endpoints that are currently available. If you click on any of these endpoints, you can automatically fill the request url and request parameter fields in the tool so it’s an easy shorthand for sending requests to the backend. You’ll notice at the top of the list of endpoints, there are two fields: one says “Active User” and the other says “Active Session ID.” This is just a convenient way to fill in the placeholders in many of the API endpoint urls that require a specific user ID or session ID parameter. The idea here is that we’ll try to populate the user ID and session ID based on the data that you’re currently viewing. This is hopefully is an easy way to click on specific endpoints and then automatically have the right information populated.

Let’s try a simple example and get the list of sessions for a specific user. I’m going to click on the get-user-userid-sessions endpoint. The url will be displayed in the address bar at the top of the page. It will show in the dropdown box that this is an http GET request, and you’ll notice that the userid will be automatically populated with the user ID in the upper left-hand corner of the page. And below that, you can see the request parameters, which you can then add values to. You can look at the documentation to see how those endpoints work, but I’ll just leave the default values in this example. Click “submit” and then this tool will send the request to the MindMeld API, and at the bottom of the page, it will show me the data that’s returned. And so you can see in the data tab in the Response Field, it will show me data about this particular session: the name, the privacy mode, the time it was created. I can either see the formatted display of what was created in the data tab, or I can see the raw JSON which you would see if you sent a curl request to the backend.

Now that was a simple example, let’s try something else. Let’s create a new session using this tool. To create a new session, you use the post-user-userid-sessions endpoint. WIth this command, you can specify the name of the session in the request parameters. Let’s call this “Test Session.” And a privacy mode, which you can made invite-only, friends-only, or public. We’ll make this one invite only. Then click “submit” and that will send an http POST method to the backend, and you should see a response that says session was created and it will give you the ID for the new session. Great, so that’s how you create a new session.


Back to Featured Articles on Logo Paperblog