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.
- full - perform a CMS detection, Parallel speed testing for Mobile and Desktop. Perform one
JSON response,
which as it receive data. Has a dynamic state.
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
- status - current state of the task, one of the following: PENDING, RECEIVED, STARTED, PROCESS-25,
PROCESS-50, PROCESS-75, SUCCESS, FAILURE, REVOKED, RETRY
- created - date and time of the check creation
- result - all the information from the checks
- cms_data - information about the CMS
- cms_id - id of the CMS used
- cms_url - the URL of the CMS
- cms_name - name of the CMS, which is detected
- wp_themes - the theme of the WordPress site (WP only)
- wp_version - the version of the WordPress installation (WP only)
- last_scanned - when it was verified for last time
- detection_param - how the CMS is detected
- desktop - information from parsing the Desktop version
- dom_size - (score 0-1) explain how optimized the dom size is. A large DOM can
increase memory usage. More information here
- cloudimage - all metrics, which are related to Cloudimage optimization
- savings_ms - potential savings in terms of speed, calculated by formula (uses_webp_images_savings_ms
* 0.4 +
uses_optimized_images_savings_ms * 0.3 + uses_responsive_images_savings_ms * 0.3) *
0.90
- savings_bytes - potential savings of bytes, calculated by formula (uses_webp_images_savings_bytes
* 0.4 +
uses_optimized_images_savings_bytes * 0.3 + uses_responsive_images_savings_bytes * 0.3) *
0.90
- biggest_images - a list with the 3 bigger images, sorted by potentialSavings
- savings_bytes_text - formated savings_bytes in form of plain text with suffix
type of formating (ex. 1.20 MB, 3.45 GB)
- implementation_score - a propotion between optimized URLS and total URLS (containing domain) CLOUDIMAGE_URLS / TOTAL_URLS_IN_DOMAIN.
If implementation_score > 0 - client uses Cloudimage and the frontend can show something. If coefficiennt is 0.95 for
example, not all of the images are go throw Cloudimage, for example logo is not optimized.
- fetch_time - date and time, when the page was fetched
- user_agent - user agent from which the request is made
- uses_http2 - a score which means if the URL use HTTP/2. 1 means it use, 0 that it don't
- diagnostics - collection of useful page vitals
- rtt - round-trip time (RTT) is the duration in milliseconds (ms) it takes for a network request
to go from a starting point to a destination and back again to the starting point
- maxRtt - max rtt
- numFonts - number of fonts
- numTasks - number of internal JS tasks
- numScripts - number of scripts
- throughput - (bps) throughput available
- numRequests - number of requests
- totalTaskTime - (ms) task time for execution
- numStylesheets - total number of stylesheets
- totalByteWeight - the size of the page
- maxServerLatency - the maximum server latency
- numTasksOver10ms - number of fast tasks - under 10 ms
- numTasksOver25ms - number of middle speed tasks - under 25 ms
- numTasksOver50ms - number of middle slow tasks - under 50 ms
- numTasksOver100ms - number of slow tasks - under 100 ms
- numTasksOver500ms - number of very slow tasks - under 500 ms
- mainDocumentTransferSize -
- interactive - (ms) time to interactive is the amount of time it takes for the page to become fully
interactive
- speed_index - (ms) Speed Index shows how quickly the contents of a page are visibly populated.
- image_alt_score - (0-1 score) Informative elements should aim for short, descriptive alternate
text.
- final_screenshot - The last screenshot captured of the pageload
- data - (data:image) the screenshot
- type - type of the object
- timing - when it is taken
- timestamp - the timestamp
- total_byte_weight - the total byte amount of the page
- content_width_score - (0-1 score) Content is sized correctly for the viewport. Important for the
mobile, in desktop can be "null". More info here
- screenshot_thumbnails - This is what the load of the website looked like
- url - the screenshot
- timing - when it is taken
- uses_text_compression - (0-1 score) Text-based resources should be served with compression (gzip,
deflate or brotli) to minimize total network bytes
- first_contentful_paint - (ms) First Contentful Paint marks the time at which the first text or image
is painted
- first_meaningful_paint - (ms) First Meaningful Paint measures when the primary content of a page is
visible.
- network_server_latency - (ms) Server latencies can impact web performance.
- offscreen_images_score - (0-1 score) Consider lazy-loading offscreen and hidden images after all
critical resources have finished loading to lower time to interactive.
- resource_summary_image - All images on the page
- size - the size of the image
- label - the label of the resourse
- requestCount - count of request
- resourceType - the type of the resourse
- resource_summary_value - string with summary of the total requests
- uses_rel_preload_score - (0-1 score) preloading key requests
- uses_webp_images_score - (0-1 score) serving images in next-gen formats
- network_requests_images - All network requests, which are images and resourceSize > 50 (to avoid
pixels). The list is sorted by "potentialSavings" value.
- url - url of the resourse
- endTime - end of request time (waterfall)
- mimeType - the type of the resourse
- startTime - start of the request (waterfall)
- statusCode - status code of the request
- resourceSize - size of the resourse
- resourceType - type of the resourse, should be image
- transferSize - a transfer size
- potentialSavings - (webp_image_savings * 0.5 + optimized_image_savings * 0.3 +
responsive_image_savings * 0.2) * 0.85
- savingProportion - resource_size / potentialSavings
- aggressiveSavings90 - resource_size * 0.14, in case of error = 0
- aggressiveSavings80 - resource_size * 0.55, in case of error = 0
- aggressiveSavings70 - resource_size * 0.62, in case of error = 0
- uses_long_cache_ttl_score - (0-1 score)serving static assets with an efficient cache policy
- offscreen_images_savings_ms - (ms) potential savings when images are lazy loaded
- uses_optimized_images_score - (0-1 score) efficiently encode images
- uses_webp_images_savings_ms - (ms) potential savings when images are in webp
- uses_responsive_images_score - (0-1 score) serving images that are appropriately-sized to save
cellular data and improve load time.
- offscreen_images_savings_bytes - (bytes) potential savings when images are lazy loaded
- uses_webp_images_savings_bytes - (bytes) potential savings when images are in webp
- uses_optimized_images_savings_ms - (ms) efficiently encoding images. Optimized images load faster
and consume less cellular data.
- uses_responsive_images_savings_ms - (ms) properly size images
- uses_optimized_images_savings_bytes - (bytes) efficiently encoding images.
- uses_responsive_images_savings_bytes - (bytes) properly size images
- unminified_javascript_score - (0-1 score) Minifying JavaScript files can reduce payload sizes and
script parse time.
- unminified_css_score - (0-1 score) Minifying CSS files can reduce network payload sizes.
- mobile - information from parsing the Mobile version
- all the same as in desktop, but parsed with User-Agent for mobile
- url - the final URL, where the test are perfmed. It shows the end URL, after the redirects if any.
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:
- error_code - the code of the error, for example DNS_FAILURE (no such domain or timout)
- error_message - a hint how the error appeared
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.
- check_uuid - a valid UUID which should be taken from the report, it is the same like the check UUID and the
report UUID
- email - a valid email address, where the email should be sended.
Things to note
- the UUID must be such from a valid check
- it will only send a email when the report is ready
- if you send a task for already ready report - it will send it, even the report is generated some days ago