Test the DayPI Without a Line of Code!

By vineet

The Daylife API tester lets you make Daylife API calls without having to write any code. Plus, it lets you visualize the data with some basic HTML. 

 

 

Read below how to start using this API tester.

 

Pre-requisites

There are only a very few things you need to do before you can start playing with the DayPIs.

a. Signup on our Developer site

b. Wait for an email that sends you a set of API credentials - an Accesskey and a Sharedsecret

Once you have your API credentials, you are ready to make your first API call using our API Tester.

Jump In

The goal of the API Tester is to give you a test bed to play with the DayPIs without having to write a single line of code.

Where to find the API Tester?

You can use the tester at http://demos.daylife.com/api_tester/

What information does one need to use the API Tester?

You will need to fill out your Accesskey and Sharedsecret under the User Info section as shown in the screenshot below. You do not need to put any data in the signature box. The API tester fills out the signature box to help you verify your signature calculation by comparing it with the one calculated by the tester.

You can add the javascript below as a bookmark in firefox to help you fill the accesskey and sharedsecret. Once you have the API tester open in firefox, click on the bookmark and you are ready to use the API tester. Just fill in your accesskey and the sharedsecret in the javascript below before adding it as a bookmark.

javascript:(function(){ var fields = document.getElementsByTagName('input'); for (var i = fields.length - 1; i >= 0; i--){ switch(fields[i].name){ case 'accesskey': fields[i].value = 'your access key'; break;	case 'sharedsecret': fields[i].value = 'your shared secret'; break;}};})()


How to select an API call in the API Tester?

The drop downs for Type and Method under the Resource Type and Method section helps you select the API call you are trying to test.

The Type drop down lists the news objects that are available. If you want to find articles for a given topic name, the topic is the news object and you select topic in the Type drop-down. Similarly, you select article Type if you have an article ID or an article URL to find related content about.

Once you have selected the Type, the Method drop-down shows you the list of functions that are available for that particular news object. For e.g., if you select topic as your Type, your Method drop down shows options such as getRelatedArticles, getRelatedImages etc.

How do I specify the parameters for an API call?

Once you have selected the method you are trying to call, you will see a stack of boxes under the Parameters section. Please read the API documentation to determine the possible values for any parameter.

How do I call the API?

Once you have filled out the API credentials, selected the API call and filled out the parameters, you can call the API by clicking on the button

The API Call URL box gives you the actual DayPI URL that was called.

How should I read the response?

The Response box displays the data returned by the DayPI call.

There are 4 tabs on the top of the Response box - HTML, XML, JSON and PHP.

Each tab except HTML helps you select the format in which you want the data to be returned by the DayPI. The HTML tab is present in the API tester to help make the DayPI response more readable.

We hope the API tester will help you get a head start in learning how to call the APIs and what kind of data comes back. If you encounter issues while using the API tester, please use the the developer forum to get your questions answered.

 

 

Filed Under: