Want to learn more about our API? We’ve got you covered.

image

In today’s post we’d like to provide an overview of our newest addition – adding a project using the Testomato REST API.

We’ll go through the following steps:

  • Login
  • Add a project
  • Logout

Here’s a quick overview of API and REST before we get started for those of you who are not familiar with the terms.

An application-programming interface (API) is a set of programming instructions and standards used for accessing web-based applications or web tools. APIs are generally released to the public so that other developers can design products powered by the service that application or tool supplies. In simple terms, this just means that applications can talk to each other without the need of a user action or intervention.

Representational State Transfer (REST) is a set of architectural principles used to design web services, which focus on the structure of a system’s resources. REST has emerged over time as a predominant API design model.

Testomato REST API

Our REST API provides simple interface solutions for Testomato functionality. Basically, your application makes an HTTP request and then, parses the JSON formatted response. We use a CURL command line tool in our documentation to perform URL calls.

All API endpoints require authentication from an API key. Every Testomato project has its own unique API key that protects your data against unwanted access. In order to perform requests, you an API key parameter is mandatory.

In order to make requests, we use standard cURL functions. cURL is a library that allows you to make HTTP requests in PHP. It’s designed to allow you to connect and communicate with different online resources from directly within your PHP script.

To learn more about cURL, we suggest taking a look at PHP’s manual on cURL or going through PHPsense.com’s cURL functions tutorial.

To get started, you’ll need to set up some variables. You’ll need your password and user login (the email you use to log into http://testomato.com/. You also have the option to request user agents.

image

How to login to our API

The following example is what you’ll need to login and find your SESSION_ID.

image

You’ll receive a valid JSON response from Testomato, which is sent using the POST method. If something goes wrong, you’ll receive the following response: $response->ok = false and $response->error = true

image

If everything was POSTed correctly, you’ll receive the following reponse: $response->ok = true and $response->session->id

image

Now, you’ll have your SESSION_ID, which is used to set the session ID for the current session. This ID will be needed to make all future requests with the Testomato API.

Add a project

Using a standard GET request with an expected URL and optional period parameters makes adding a project simple.

The possible period parameters are:

  • 5 minutes
  • 30 minutes
  • 1 hour
  • 8 hours
  • 1 day
  • 7 days

You’ll send a GET request to the following resource:

http://www.testomato.com/api/project/create?

image

Your response should look like this:

image

Well done! If you receive a 200 header response, you’ve successfully added a new project to your user account.

Logout

You also have the option to logout of your session after you’ve finished.

image

Click here for the full Github Gist for adding a project to Testomato using our REST API.

What else would you like to use Testomato REST API to do?

Share your thoughts here or on Facebook. Or, tweet us directly @testomatocom.