Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step

Screenshot

Open ASM

Navigate to Tools, API

Select a check using the drop-down box

Select the Target check for the API

We've selected the Test Demo check. Beneath that check selection is some example API calls to help you get started quickly.

We've copied the Last Result call pasted it into Postman to run it.

 

Postman Results of Standard API Check Endpoint

Here, via API, is the last value of your check run, 200.

200 is the last status code of the URL. This is nice but is just a raw number without data or context, and there's no JSON used. This could be used just for a small script or something you can pull the last result of your check maybe test it for something.

A better API endpoint is the Checks Generic Check ID Results API endpoint.

Apica API for Generic Results

This API endpoint looks up the results for checks that present a result type of generic. 'Generic' checks mean that they have the expandable JSON result format we saw in Step 5 above.

Generic type Checks: Run Python scripts, Run Javascript, Run Java, and (when released) Run Azure Cloud, Run Lamda, etc.

Postman Results of Generic API Check Endpoint

In Postman, using this API endpoint:

https://api-wpmasm1.apicasystemapica.comio/dev/Checks/generic/43454/results?

auth_ticket=18FFE***-****-****-****-****0DCO

Instead of the earlier (for comparison):

https://api-wpmasm1.apicasystemapica.comio/dev/Checks/49454/lastvalue?auth_ticket=18FFE***-****-****-****-****0DCO

The API documentation for Generic Check shows these capabilities:

  • Set a filter with a range

    • Return the most recent results

    • Return results that occurred in between defined two-millisecond values that, for example, answer the question, "What results came in between 1.2 and 2.3 seconds?"

  • Define a period to query (between two UTC stamps)

  • Return specific results IDs.

This is a POST endpoint:

Note the JSON results returned above. So you may need to use these in some other API call to lookup even more information. In this example, we're just going to use the most recent because that is the simplest and easiest to show.

The Result Object

Note the headers that returned and (not shown in the screen capture) the content size, the header count, etc. All of the information you recorded in your script comes through the API.

What you choose to do next with these metrics is all up to your needs.

  • You could create a script that scrapes this URL every once in a while, looks up to the last hour of results, and parses the JSON for data that you need.

  • You could even create another check that would read this information and then crunch the data to present other results, e.g., the average size of the headers or content length.

  • There is much more, only limited by your use cases.

...