Solve API problems fast with Runscope. Learn More →

Push Runscope API Health Notifications to VictorOps for Real-time Alerts

By Ashley Waxman on .

Getting informed the moment an API issue occurs is a crucial component of effective API monitoring. We’re thrilled to announce a new integration with VictorOps, an alert management system that allows IT and DevOps teams to prepare for, react to and recover from incidents in real time. By connecting your Runscope API tests directly with VictorOps, you’ll be the first to know about your API’s performance and events that can impact your infrastructure or customers. 

Integrating your Runscope tests with VictorOps is simple. First, enable the Runscope integration from VictorOps and copy the VictorOps API key to your clipboard.

From Runscope, go to API Tests, select the test you wish to connect to VictorOps and click Edit Test. Or, create a new test. From there, select Integrations, and scroll down to connect VictorOps. Enter the API key from VictorOps and the notification threshold, click Connect Account and you’re all set! You can also add a VictorOps routing key if you wish to route alerts to a specified subset of your team.

As soon as a connected VictorOps service is enabled, any API test runs that fail will trigger an incident and send the notifications defined in your VictorOps service settings, which will enable you to take action to resolve issues fast.

If you like this integration, we have dozens more for you to try and signing up for Runscope is free. Our integrations span the most popular analytics platforms like Datadog and Keen IO so you can dig deeper into API performance.

Categories: announcements, integrations, howto, product

Create API-First Web Apps with API Platform, a PHP Framework

By Neil Mansilla on .

Every programming language is subject to scrutiny, and PHP is no exception. While often pegged as an all too basic language forged some time during the Gilded Age, PHP has done more than just stand the test of time—the language and its ecosystem have continued to evolve. In fact, one article cites that PHP has over 25 web application frameworks (10 with recent version updates), eclipsed only by Java with 37.

Just last week, PHP added yet another web application framework to the fold, Dunglas’s API Platform (DAP). Developed by Symfony core developer Kévin Dunglas, DAP is an API-first web framework built on top of Symfony, one of PHP's most popular frameworks. DAP embraces hypermedia and open standards, like JSON-LD, Hydra and Schema.org

Even though DAP is in its early stages (currently beta), it shows a lot of promise in becoming a very useful framework on its own, or at least one that influences developers to pursue an API-first development approach. Built on top of the full-stack Symfony framework, DAP gives you access to an enormous library of Symfony bundles (including bundles for OAuth and JWT).

API-first Development

About six years ago, the concept of mobile first was born, recognizing that we’d be consuming more content and using more apps on our mobile devices than on our PCs/desktops. In 2014, we crossed that inflection point. And in recent years, designers and developers have recognized that data and services are being consumed across a growing number of platforms and devices, bringing us to a new concept—API first development, which prioritizes building well-designed, architected and robust APIs before building the apps that consume them.

Getting Started with API Platform

Even if you're not a PHP developer, you'll be able to follow along with how to use DAP. Begin by creating a hypermedia API. Dunglas recommends defining your model using Schema.org vocabulary to avoid re-inventing the wheel. Though you’re not required to use Schema.org nor the generator, doing so will deliver fully generated PHP entities complete with type documentation, ORM mapping and validation annotations and much more. Before you begin customizing and optimizing, go through the process laid out in the README to better understand where your hand-crafted customizations are needed.

Generation Tools at your Fingertips

After defining your schema in YAML, run it through some of DAP’s bundled tools. First, you’ll use PHP Schema, a bundled project component to generate the PHP entities that represent your data model. At this point, you can start making code customizations to the entities.

Next, you’ll use Doctrine ORM (also bundled) to create the database and generate the tables for your API. Doctrine is optional and in fact, using a database is optional. However, while you're investigating DAP, use the bundled ORM as well as a database to observe all of DAP's functionality.

One Step to Creating Docs

Using another bundled tool, DAP generates nicely formatted Swagger UI-like documentation. The docs are available at the /doc endpoint as soon as you launch the server. Each parameter shows well-defined types of docs inherited from the Schema.org vocabulary. In the example below, we use the schema configuration for a blogging app, with blog posts and people (authors) as the main resources.

Getting Down with REST

Now that the API is up and running, you can start executing calls. Some features that you get out of the box are a series of CRUD operations through RESTful methods, request validation against the schema, error handling and more. In the example below, we take an empty resource (/people), POST a new record, GET the collection and then DELETE the person we just added.

Now, Start Coding!

After you've defined, generated and stood up the API, it's time to build the client application. The author has included an AngularJS integration, but can easily work with any client technology such as Ionic, React or your favorite native mobile framework.

What's Good, What's Next

Dunglas's API Platform framework serves as a great introduction to the concept of API-first development. It's also a swell introduction to hypermedia APIs, with support for Schema.org, JSON-LD and Hydra.

For more information about DAP check out the project repo. You can start testing and monitoring your APIs, whether on DAP or any other platform, for free with Runscope

Categories: apis, howto, community, api ecosystem, hypermedia

Build Synthetic API Tests for Single Page Apps Using Runscope

By Neil Mansilla on .

Our modern web applications are becoming more complex than ever, and we are building and relying on more tools and frameworks to keep up. For instance, a single page app sounds drop dead simple, right? From the user’s perspective, yes. But from the development perspective, a single page app is often chock full of complexity—heaps of JavaScript and asynchronous HTTP requests.

Today, it’s becoming easier to build more complex apps. However, convenience and magic afforded by frameworks can often make it more difficult for debugging and testing. With apps consuming more and more APIs to properly debug a problem, you’ll likely need to inspect traffic or run functional tests against those API calls. Lucky for you, there are a couple of handy tools to help: the HAR file format and Runscope.

What the HAR?

If you want to debug your web app’s API calls, web browser support for the HAR file format can be quite useful. HAR, or HTTP Archive, is a JSON-formatted archival format for logging a web browser’s interaction with a site. To generate HAR files, begin in the Google Chrome debugger/inspector and select the “Network” view in which you can export the entire list of HTTP logged HTTP requests into a HAR file. HAR exporting is also available on Firefox with the Firebug extension.

Synthetic API tests simulate actions that an end-user would take using your single page app and complement your test suite of specification-driven API tests. Building these tests couldn’t be easier with Runscope, requiring only your web browser and a HAR file export.

We'll try it by navigating to one of our favorite web apps that makes use of background HTTP requests, Google Maps. In the screenshot below, we drag the map around a few times with the mouse, triggering several background API calls. Then, we export the XHR (API) requests into a HAR file using Chrome's debugger. Inside the saved HAR file are three API requests that were created dynamically by using the web app—perfect candidates from which to build a synthetic API test.

Creating a Runscope Test with HAR Import

Creating an API test using Runscope’s UI has always been easy, but importing makes it even easier. Below, we click Import from the API Tests menu in our Runscope dashboard, then chose HAR and selected the HAR file from our computer. Instantly, Runscope creates a new synthetic API test containing the three API requests that we captured from our previous browser session.

Start testing and monitoring the APIs behind your single page web app by signing up for free today. Additionally, if you’d like to test and monitor your web app’s UI, try Ghost Inspector for automated browser testing in the cloud—it's also free!

Categories: howto, product

Connect Runscope with Datadog for Robust Dashboards and Alerts

By Ashley Waxman on .

API monitoring is an essential component of any developer’s toolkit, but monitoring the data that API monitoring collects is also important to get fine-grained insight into API performance over time. We’ve made it even easier to monitor and analyze your Runscope data by integrating with Datadog, a monitoring platform that tracks your IT and cloud infrastructure. By connecting your Runscope tests to your Datadog instance, you can dig deeper into API performance by creating events and metrics from your API test runs and build correlations to the performance of your operational IT infrastructure.

As soon as you connect a test to your Datadog dashboard, it will immediately begin monitoring your data. By measuring API performance against your IT infrastructure data, you can more quickly and precisely uncover the cause of API issues that might be related to your infrastructure.

Using Runscope with Datadog to Monitor API Performance Data

Connecting Runscope tests to your Datadog account is easy. First, create an API key from your Datadog account and copy it to your clipboard. Then from your Runscope API test, select Integrations in the left-hand navigation, then Connect Datadog. On the settings screen, enter your Datadog API key. If you need different Datadog settings for individual tests, you can go through the connection process multiple times on a per-test or per-bucket basis.

Once you connect Runscope with Datadog, you can create a dashboard that looks like the screenshot above. We have API performance data from Runscope at the top and CPU load data from a backend server on the bottom for this example. When API response time begins to spike after 00:20 (top), you can use your Datadog dashboard to easily correlate a spike in CPU usage that began several minutes before. After CPU load settles back to its normal near-idle state, the API response times will also begin to fall down. This is just one example of how you can use Runscope with Datadog to track down the root cause of API problems.

If you like this integration, give some of our others a try by signing up for free today. We connect with the most popular communications platforms like Slack, PagerDuty, HipChat and more

Categories: announcements, howto, product, integrations

Everything is going to be 200 OK