REST Endpoints¶
-
POST
/tests/
¶ Given a string of HAR data, creates a new ‘test’ entry (as well as it’s corresponding ‘page’ resources).
Example request:
POST /tests/ HTTP/1.1 Host: har-api.com Accept: application/json, text/javascript { "har_data": "{"log": {"pages": [{"id": "page_3", ......." }
Example response:
HTTP/1.1 200 OK Vary: accept Content-Type: text/javascript { "data": { "browser_name": "Firefox", "browser_version": "25.0.1", "hostname": "humanssuck.net", "name": null, "pages": [ { "audio_load_time": 0.0, .... see page object for details ..... "video_size": 0.0 } ], "startedDateTime": "Sun, 22 Feb 2015 19:28:12 -0000" } }
Request JSON Object: - har_data (string) – Raw HAR data (JSON)
- name (string) – A custom name for the test, which can be used later for searching
Response JSON Object: - id (integer) – System assigned ID
- browser_name (string) – Name of browser used for test
- browser_version (string) – Browser version used for test
- hostname (string) – Hostname of the test
- name (string) – Custom test name
- pages (array) – An array of page objects
- startedDateTime – Start date/time of the test run
Status Codes: - 201 Created – Test created without issue
- 500 Internal Server Error – internal error
-
GET
/tests/
¶ Returns a collection of HAR tests based on filters.
Example request:
GET /tests/?hostname=humanssuck.net HTTP/1.1 Host: har-api.com Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: accept Content-Type: text/javascript
Query Parameters: - hostname – Hostname of the test
- name – Custom name for the tests
Status Codes: - 200 OK – You’ve got tests!
- 500 Internal Server Error – internal error
-
GET
/pages/
¶ Retrieve a collection of pages based on filter critieria Example request:
GET /pages/?hostname=humanssuck.net HTTP/1.1 Host: har-api.com Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: accept Content-Type: text/javascript
Query Parameters: - hostname – Hostname of the page
- name – Custom name for the test containing this page
Status Codes: - 200 OK – You’ve got tests!
- 500 Internal Server Error – internal error
-
GET
/tests/
(int: test_id)/
¶ Returns a single test object (representing a HAR file of a full test run) with test_id.
Example request:
GET /tests/123/ HTTP/1.1 Host: har-api.com Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: accept Content-Type: text/javascript { "data": { "browser_name": "Firefox", "browser_version": "25.0.1", "hostname": "humanssuck.net", "name": null, "pages": [ { "audio_load_time": 0.0, .... see page object for details ..... "video_size": 0.0 } ], "startedDateTime": "Sun, 22 Feb 2015 19:28:12 -0000" } }
Response JSON Object: - id (integer) – System assigned ID
- browser_name (string) – Name of browser used for test
- browser_version (string) – Browser version used for test
- hostname (string) – Hostname of the test
- name (string) – Custom test name
- pages (array) – An array of page objects
- startedDateTime – Start date/time of the test run
Status Codes: - 200 OK – I haz test 4 u
- 404 Not Found – test not found
- 500 Internal Server Error – internal error
-
GET
/pages/
(int: page_id)/
¶ Returns a single page object (representing one page of a HAR test) specified by page_id.
Example request:
GET /pages/123/ HTTP/1.1 Host: har-api.com Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: accept Content-Type: text/javascript "data": { audio_load_time: 0, audio_size: 0, css_load_time: 76, css_size: 8, hostname: "humanssuck.net", html_load_time: 153, id: 1, image_load_time: 304, image_size: 23591, js_load_time: 310, js_size: 38367, page_id: "page_3", page_load_time: 567, page_size: 62204, startedDateTime: "Sun, 22 Feb 2015 19:28:12 -0000", test_id: 2, text_size: 246, time_to_first_byte: 153, url: "http://humanssuck.net/", video_load_time: 0, video_size: 0 }, ............................
Response JSON Object: - audio_load_time (integer) – Total load time for audio files (ms)
- css_load_time (integer) – Total load time for CSS files (ms)
- css_size (integer) – Total size of CSS assets (kb)
- hostname (string) – Hostname of the page request
- html_load_time (integer) – Total load time for HTML files (ms)
- id (integer) – System assigned id
- image_load_time (integer) – Total load time for image files (ms)
- image_size (integer) – Total size of image assets (kb)
- js_load_time (integer) – Total load time for javascript files (ms)
- js_size (integer) – Total size of javascript assets (ms)
- page_id (string) – Page ID as specified in the HAR file
- page_load_time (integer) – Total page load time (ms)
- page_size (integer) – Total page size (kb)
- startedDateTime (string) – Start date/time of the test
- test_id (integer) – System assigned ID of parent test
- text_size (integer) – Total size of all text assets (kb)
- time_to_first_byte (integer) – Time to first byte (ms)
- url (string) – Canonical URL of page request
- video_load_time (integer) – Total load time of videos assets (ms)
- video_size (integer) – Total size of loaded video files (kb)
Status Codes: - 200 OK – I haz page 4 u
- 404 Not Found – page not found
- 500 Internal Server Error – internal error