Endpoint

https://reports-v2.scaleflex.com/api/v2/check/

Accept POST requests from the UI or

curl -X POST https://reports.scaleflex.com/api/v1/check/ -d '{ "type": "full", "url": "https://www.lemonde.fr/" }' -H "Content-Type: application/json" 

Tasks

A task means an operation which the Cloudimage Reports Tool performs. Some of the task are havy and took more time, some of them are quick and can be used for fast checks.

Authorization

When autorization is enabled, you should insert additional header:

-H 'Authorization: Token g177113c541ac26fe5d421f5db7155eac309cee2'

Where token should be the token from the User Profile page

Caching of the result

If the same query is made in the last 6 hours - result is cached.

That means that if I send two queries in 5 minutes for the same address - I will get a cached result for the second.

Result URL

Every result and keeped in the result URL with the same UUID of the check.

This JSON is static, so it is not generating on the fly. It is useful to insert in reports, send to other people, etc.

It is possible in the result JSON the URL which is shown to be different, than the request. That is because we are trying to find the end URL, after the redirects. So if we send scaleflex.com, the verified address will be: https://www.scaleflex.com/en/home

Dynamic results

Every task is performed asynchronously. If there are ready result - it will be populated in the result URL.

There is percentage for keep tracking of the progress - STARTED, PROCESS-25, PROCESS-33, PROCESS-50, PROCESS-66, PROCESS-75, SUCCESS

Object in result JSON

Cloudimage formula saving

In order to bypass some Cloudflare warnings and make the reports run faster, now it is calculating the saving metrics like this:

savings_ms = (uses_webp_images_savings_ms * 0.5 +
                           uses_optimized_images_savings_ms * 0.3 + uses_responsive_images_savings_ms * 0.2) * 0.85
savings_bytes = (uses_webp_images_savings_bytes * 0.5 +
                              uses_optimized_images_savings_bytes * 0.3 + uses_responsive_images_savings_bytes * 0.2) * 0.85

0.90 is coefficient to reduce possible errors and avoid too litle result to show.

The idea is that Cloudimage for sure will serve the images in WebP and they will be optimized. So formula show some kind of abstract result, which is also true for the last method we used.

This formula can be changed also.

Example result

An example for response can be found here: https://reports.scaleflex.com/api/v1/result/727c0acb-2a61-4fc6-8c81-187c8532feb8/

Errors

Sometimes the API can return a status codes. For example if the domain doesn't exist.

The error in the API can appear both in desktop and mobile checks:

List of status codes:

  • UNKNOWN_ERROR - An uncategorized error occurred, likely a JavaScript exception
  • NO_SPEEDLINE_FRAMES - The trace did not contain any screenshot events
  • SPEEDINDEX_OF_ZERO - No visual change between the beginning and end of load
  • NO_SCREENSHOTS - The trace did not contain any screenshot events
  • INVALID_SPEEDLINE - The computed speedindex results are non-finite
  • NO_TRACING_STARTED - The trace did not contain a TracingStartedInPage event
  • NO_DOCUMENT_REQUEST - No network request could be identified as the primary HTML document
  • FAILED_DOCUMENT_REQUEST - The HTML document's network request failed due to Chrome-internal reasons
  • ERRORED_DOCUMENT_REQUEST - The HTML document's network request completed, but returned an HTTP status
  • TRACING_ALREADY_STARTED - Chromium's tracing controller did not manage to begin tracing across
  • PARSING_PROBLEM - The trace data wasn't parsed correctly
  • READ_FAILED - The trace data failed to stream over the protocol
  • INSECURE_DOCUMENT_REQUEST - Used when security error prevents page load
  • PROTOCOL_TIMEOUT - Used when protocol command times out
  • PAGE_HUNG - Used when the page is not responding after maxWaitForLoad (45 seconds)
  • DNS_FAILURE - DNS failure on main document (no resolution, timed out, etc)
  • CRI_TIMEOUT - A timeout in the initial connection to the debugger protocol
  • Emails

    The endpoint: https://reports.scaleflex.com/api/v1/email/

    It accept email and report UUID and use the internal API to send the email templates. It accept a POST request.

    Things to note