github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/api/README.md (about)

     1  # wpt.fyi API
     2  
     3  This package defines and implements HTTP API endpoints for [wpt.fyi](https://wpt.fyi/), and this
     4  document covers usage and parameters of those endpoints.
     5  
     6  ## Resource endpoints
     7  
     8  Here's a list of endpoints to query various resources. An exhaustive list of
     9  the endpoints can be found in `routes.go`.
    10  
    11   - [/api/runs](#apiruns)
    12   - [/api/runs/{id}](#apirunsid)
    13   - [/api/run](#apirun)
    14   - [/api/shas](#apishas)
    15   - [/api/diff](#apidiff)
    16   - [/api/results](#apiresults)
    17   - [/api/manifest](#apimanifest)
    18   - [/api/search](#apisearch)
    19   - [/api/metadata](#apimetadata)
    20   - [/api/metadata/pending](#apimetadatapending)
    21   - [/api/metadata/triage](#apimetadatatriage)
    22   - [/api/bsf](#apibsf)
    23   - [/api/history](#apihistory)
    24  
    25  Also see [results creation](#results-creation) for endpoints to add new data.
    26  
    27  ## TestRun entities
    28  
    29  `TestRun` entities represent metadata about an execution of the [wpt](https://github.com/web-platform-tests/wpt) test suite, on a particular product. Tests are run on a regular basis, and each entry in `/api/runs` annotates when the tests were executed, which product they were executed on, and the where the results are stored.
    30  
    31  ### /api/runs
    32  
    33  Gets the TestRun metadata for all runs for a given SHA[0:10], sorted by `time_start` descending.
    34  
    35  __Parameters__
    36  
    37  __`sha`__ : SHA[0:10] of the runs to get, or the keyword `latest`. Defaults to `latest`.
    38  
    39  __`product`__ : Product(s) to include (repeated param), e.g. `chrome` or `firefox-60`.
    40  
    41  __`aligned`__ : boolean for whether to get only SHAs which were executed across all of the requested `product`s.
    42  
    43  __`labels`__: A comma-separated list of labels, e.g. `firefox,stable`; only runs with all
    44  the given labels will be returned. There are currently two kinds of labels supported,
    45  browser names (`chrome`, `edge`, `firefox`, `safari`) and release channels (`experimental`
    46  or `stable`).
    47  
    48  __`from`__ : RFC3339 timestamp, for which to include runs that occured after the given time.
    49  NOTE: Runs are sorted by `time_start` descending, so be wary when combining this parameter
    50  with the `max-count` parameter below.
    51  
    52  __`to`__ : RFC3339 timestamp, for which to include runs that occured before the given time.
    53  
    54  __`max-count`__ : Maximum number of runs to get (for each browser). Maximum of 500.
    55  
    56  #### staging.wpt.fyi only (Beta params)
    57  
    58  __`pr`__ (Beta): GitHub PR number. Shows runs for commits that belong to the PR.
    59  
    60  #### Examples
    61  
    62  - https://wpt.fyi/api/runs?product=chrome&product=safari
    63  - https://wpt.fyi/api/runs?product=chrome&from=2018-01-01T00:00:00Z&max-count=10
    64  
    65  <details><summary><b>Example JSON</b></summary>
    66  
    67      [
    68        {
    69          "browser_name": "chrome",
    70          "browser_version": "67.0.3396.62",
    71          "os_name": "linux",
    72          "os_version": "4.4",
    73          "revision": "2bd11b91d4",
    74          "full_revision_hash": "2bd11b91d490ddd5237bcb6d8149a7f25faaa101",
    75          "results_url": "https://storage.googleapis.com/wptd/2bd11b91d4/chrome-stable-linux-summary_v2.json.gz",
    76          "created_at": "2018-06-05T08:27:30.627865Z",
    77          "raw_results_url": "https://storage.googleapis.com/wptd-results/2bd11b91d490ddd5237bcb6d8149a7f25faaa101/chrome_67.0.3396.62_linux_4.4/report.json"
    78        }
    79      ]
    80  
    81  </details>
    82  
    83  ### /api/runs/{id}
    84  
    85  Gets a specific (single) TestRun metadata by its datastore ID.
    86  
    87  #### Example
    88  
    89  https://wpt.fyi/api/runs/5184362994728960
    90  
    91  <details><summary><b>Example JSON</b></summary>
    92  
    93      {
    94        "id": "5164888561287168",
    95        "browser_name": "chrome",
    96        "browser_version": "67.0.3396.62",
    97        "os_name": "linux",
    98        "os_version": "4.4",
    99        "revision": "2bd11b91d4",
   100        "full_revision_hash": "2bd11b91d490ddd5237bcb6d8149a7f25faaa101",
   101        "results_url": "https://storage.googleapis.com/wptd/2bd11b91d4/chrome-stable-linux-summary_v2.json.gz",
   102        "created_at": "2018-06-05T08:27:30.627865Z",
   103        "raw_results_url": "https://storage.googleapis.com/wptd-results/2bd11b91d490ddd5237bcb6d8149a7f25faaa101/chrome_67.0.3396.62_linux_4.4/report.json"
   104      }
   105  
   106  </details>
   107  
   108  ### /api/run
   109  
   110  Gets a specific (single) TestRun metadata by `product` and `sha`.
   111  
   112  __Parameters__
   113  
   114  __`sha`__ :  SHA[0:10] of the runs to get, or the keyword `latest`. Defaults to `latest`.
   115  
   116  __`product`__ : browser[version[os[version]]]. e.g. `chrome-63.0-linux`
   117  
   118  #### Example
   119  
   120  https://wpt.fyi/api/run?sha=latest&product=chrome
   121  
   122  <details><summary><b>Example JSON</b></summary>
   123  
   124      {
   125        "id": "5164888561287168",
   126        "browser_name": "chrome",
   127        "browser_version": "67.0.3396.62",
   128        "os_name": "linux",
   129        "os_version": "4.4",
   130        "revision": "2bd11b91d4",
   131        "full_revision_hash": "2bd11b91d490ddd5237bcb6d8149a7f25faaa101",
   132        "results_url": "https://storage.googleapis.com/wptd/2bd11b91d4/chrome-stable-linux-summary_v2.json.gz",
   133        "created_at": "2018-06-05T08:27:30.627865Z",
   134        "raw_results_url": "https://storage.googleapis.com/wptd-results/2bd11b91d490ddd5237bcb6d8149a7f25faaa101/chrome_67.0.3396.62_linux_4.4/report.json"
   135      }
   136  
   137  </details>
   138  
   139  ### /api/shas
   140  
   141  Gets an array of revisions (SHA[0:10]), in reverse chronological order.
   142  This method behaves similarly to [/api/runs](#apiruns) above, but projects the `revision` field's value.
   143  
   144  __Parameters__
   145  
   146  __`aligned`__ : boolean for whether to get only SHAs which were executed across all of the requested `product`s.
   147  
   148  __`product`__ : Product(s) to include (repeated param), e.g. `chrome` or `firefox-60`
   149  
   150  __`from`__ : RFC3339 timestamp, for which to include runs that occured after the given time.
   151  NOTE: Runs are sorted by `time_start` descending, so be wary when combining this parameter
   152  with the `max-count` parameter below.
   153  
   154  __`to`__ : RFC3339 timestamp, for which to include runs that occured before the given time.
   155  
   156  __`max-count`__ : Maximum number of runs to get (for each browser). Maximum of 500.
   157  
   158  #### Example
   159  
   160  https://wpt.fyi/api/shas?product=chrome
   161  
   162  <details><summary><b>Example JSON</b></summary>
   163  
   164      [
   165        "98530fb944",
   166        "2bd11b91d4"//, ...
   167      ]
   168  
   169  </details>
   170  
   171  ## Results summaries
   172  
   173  The following methods apply to the results summaries JSON blobs, which are linked to from
   174  [TestRun entities](#test-run-entities).
   175  
   176  ### /api/results
   177  
   178  Performs an HTTP redirect for the results summary JSON blob of the given TestRun.
   179  
   180  __Response format__
   181  
   182  The summary JSON format has been updated as of July 2022, and all requisite
   183  summary files should now follow this  newformat. Summary files with the new format
   184  are denoted with the `_v2` file name suffix. This change was made to
   185  differentiate a test's overall status value from the subtest passes and
   186  totals.
   187  
   188  The v2 summary JSON is in the format
   189  
   190      {
   191        "/path/to/test.html": {
   192          "s": "O",
   193          "c": [1, 1]
   194        },
   195      }
   196  
   197  Each test path has two properties.
   198  
   199  `s`, or status, which is an abbreviated value to the test's overall status.
   200  
   201  `c`, or counts, which is an array containing
   202  [`number of subtest passes`, `total subtests`].
   203  
   204  __Status abbrevations__
   205  
   206  | Status              | Abbreviation |
   207  |---------------------|--------------|
   208  | OK                  | O            |
   209  | PASS                | P            |
   210  | FAIL                | F            |
   211  | SKIP                | S            |
   212  | ERROR               | E            |
   213  | NOTRUN              | N            |
   214  | CRASH               | C            |
   215  | TIMEOUT             | T            |
   216  | PRECONDITION_FAILED | PF           |
   217  
   218  Any summary files before this update follow the old JSON format (v1). The v1
   219  summary format has no additional name suffix, unlike v2.
   220  
   221  The v1 JSON is in the format
   222  
   223      {
   224        "/path/to/test.html": [2, 2],
   225      }
   226  
   227  Where the array contains [`number of subtest passes`, `total subtests`].
   228  The test's overall status is added with these subtest values. A passing status
   229  value (`OK` or `PASS`) will increment the number of subtest passes.
   230  
   231  __Parameters__
   232  
   233  __`product`__ : Product to fetch the results for, e.g. `chrome-66`
   234  
   235  __`sha`__ : SHA[0:10] of the TestRun to fetch, or the keyword `latest`. Defaults to `latest`.
   236  
   237  #### Example
   238  
   239  https://wpt.fyi/api/results?product=chrome
   240  
   241  <details><summary><b>Example JSON</b> (from the summary_v2.json.gz output)</summary>
   242  
   243      {
   244        "/css/css-text/i18n/css3-text-line-break-opclns-213.html": [1, 1],
   245        "/css/css-writing-modes/table-progression-vrl-001.html": [1, 1],
   246        // ...
   247      }
   248  
   249  </details>
   250  
   251  ### /api/diff
   252  
   253  Computes a summary JSON blob of the differences between two TestRun summary blobs,
   254  in the format of an array of [improved, regressed, total-delta].
   255  
   256  __Parameters__
   257  
   258  __`run_ids`__ : Exactly two numerical IDs for the "before" and "after" runs (in
   259  that order), separted by a comma. IDs associated with runs can be obtained by
   260  querying the `/api/runs` API. This overrides the `before` and `after` params.
   261  
   262  __`before`__ : [product]@[sha] spec for the TestRun to use as the before state.
   263  
   264  __`after`__ : [product]@[sha] spec for the TestRun to use as the after state.
   265  
   266  __`path`__ : Test path to filter by. `path` is a repeatable query parameter.
   267  
   268  __`filter`__ : Differences to include in the summary.
   269   - `A` : Added - tests which are present after, but not before.
   270   - `D` : Deleted - tests which are present before, but not after.
   271   - `C` : Changed - tests which are present before and after, but the results summary is different.
   272   - `U` : Unchanged - tests which are present before and after, and the results summary count is not different.
   273  
   274  ## Test Manifest
   275  
   276  The following methods apply to the retrieval and filtering of the Test Manifest in [WPT](https://github.com/web-platform-tests/wpt),
   277  which contains metadata about each test.
   278  
   279  ### /api/manifest
   280  
   281  Gets the JSON of the WPT manifest GitHub release asset, for a given `sha` (defaults to latest).
   282  
   283  __Parameters__
   284  
   285  __`sha`__ : SHA of the [WPT](https://github.com/web-platform-tests/wpt) repo PR for which to fetch,
   286      the manifest, or the keyword `latest`. (Defaults to `latest`.)
   287  
   288  NOTE: The full SHA of the fetched manifest is returned in the HTTP response header `X-WPT-SHA`, e.g.
   289  
   290      X-WPT-SHA: abcdef0123456789abcdef0123456789abcdef01
   291  
   292  __Response format__
   293  
   294  The high-level structure of the `v4` manifest is as follows:
   295  
   296      {
   297        "items": {
   298          "manual": {
   299              "file/path": [
   300                manifest_item,
   301                ...
   302              ],
   303              ...
   304          },
   305          "reftest": {...},
   306          "testharness": {...},
   307          "visual", {...},
   308          "wdspec": {...},
   309        },
   310      }
   311  
   312  `manifest_item` is an **array** (nested in the map's `"file/path"` value's array) with varying contents. Loosely,
   313  
   314  - For `testharness` entries: `[url, extras]`
   315    - `extras` example: `{"timeout": "long", "testdriver": True}`
   316  - For `reftest` entries: `[url, references, extras]`
   317    - `references` example: `[[reference_url1, "=="], [reference_url2, "!="], ...]`
   318    - `extras` example: `{"timeout": "long", "viewport_size": ..., "dpi": ...}`
   319  
   320  ## Results creation
   321  
   322  ### /api/results/upload
   323  
   324  Uploads a wptreport to the dashboard to create the test run.
   325  
   326  This endpoint only accepts POST requests. Requests need to be authenticated via HTTP basic auth.
   327  Please [file an issue](https://github.com/web-platform-tests/wpt.fyi/issues/new) if you want to
   328  register as a "test runner", to upload results.
   329  
   330  #### File payload
   331  
   332  __Content type__: `multipart/form-data`
   333  
   334  __Parameters__
   335  
   336  __`labels`__: (Optional) A comma-separated string of labels for this test run. Currently recognized
   337  labels are "experimental", "stable" (the release channel of the tested browser) and "master" (test run
   338  from the master branch).
   339  
   340  __`callback_url`__: (Optional) A URL that the processor should `POST` when successful, which will
   341  create the TestRun. Defaults to /api/results/create in the current project's environment (e.g. wpt.fyi for
   342  wptdashboard, staging.wpt.fyi for wptdashboard-staging).
   343  
   344  __`result_file`__: A **gzipped** JSON file, with the filename ending with `.gz` extension, produced by `wpt run --log-wptreport`.
   345  This field can be repeated to include multiple files (for chunked reports).
   346  
   347  __`screenshot_file`__: A **gzipped** screenshot database produced by `wpt run --log-screenshot`.
   348  This field can be repeated to include multiple links (for chunked reports).
   349  
   350  The JSON file roughly looks like this:
   351  
   352  ```json
   353  {
   354    "results": [...],
   355    "time_start": MILLISECONDS_SINCE_EPOCH,
   356    "time_end": MILLISECONDS_SINCE_EPOCH,
   357    "run_info": {
   358      "revision": "WPT revision of the test run",
   359      "product": "your browser",
   360      "browser_version": "version of the browser",
   361      "os": "your os",
   362      "os_version": "OPTIONAL OS version",
   363      ...
   364    }
   365  }
   366  ```
   367  
   368  __Notes__
   369  
   370  The `time_start` and `time_end` fields are numerical timestamps (in milliseconds since the UNIX epoch)
   371  when the whole test run starts and finishes. They are optional, but encouraged. `wpt run` produces
   372  them in the report by default.
   373  
   374  `run_info.{revision,product,browser_version,os}` are required, and should be automatically
   375  generated by `wpt run`. If for some reason the report does not contain these fields (e.g. old WPT
   376  version, Sauce Labs, or custom runners), they can be overridden with the following *optional*
   377  parameters in the POST payload (this is __NOT__ recommended; please include metadata in the reports
   378  whenever possible):
   379  
   380  * __`revision`__ (note this should be the full revision hash, not a 10-char truncation)
   381  * __`browser_name`__ (note that it is not called `product` here)
   382  * __`browser_version`__
   383  * __`os_name`__ (note that it is not called `os` here)
   384  * __`os_version`__
   385  
   386  #### URL payload
   387  
   388  __Content type__: `application/x-www-form-urlencoded`
   389  
   390  __Parameters__
   391  
   392  __`result_url`__: A URL to a **gzipped** JSON file produced by `wpt run --log-wptreport` (see above
   393  for its format). This field can be repeated to include multiple links (for chunked reports).
   394  
   395  __`screenshot_url`__: A URL to a **gzipped** screenshot database produced by `wpt run --log-screenshot`.
   396  This field can be repeated to include multiple links (for chunked reports).
   397  
   398  __`callback_url`__: (Optional) A URL that the processor should `POST` when successful, which will
   399  create the TestRun. Defaults to /api/results/create in the current project's environment (e.g. wpt.fyi for
   400  wptdashboard, staging.wpt.fyi for wptdashboard-staging).
   401  
   402  __`labels`__: (Optional) A comma-separated string of labels for this test run. Currently recognized
   403  labels are "experimental" and "stable" (the release channel of the tested browser).
   404  
   405  ### /api/results/create
   406  
   407  This is an *internal* endpoint used by the results processor.
   408  
   409  ## Querying test results
   410  
   411  ### /api/search
   412  
   413  Search for test results over some set of test runs. This endpoint accepts POST and GET requests.
   414  
   415  - POST requests are forwarded to the searchcache for structured queries, with
   416    `run_ids` and `query` fields in the JSON payload; see [search query](./query/README.md#apisearch)
   417    documentaton for more information.
   418  
   419  - GET requests are unstructured queries with the following parameters:
   420  
   421  
   422  __Parameters__
   423  
   424  __`run_ids`__ : (Optional) A comma-separated list of numerical ids associated
   425  with the runs over which to search. IDs associated with runs can be obtained by
   426  querying the `/api/runs` API. Defaults to the default runs returned by
   427  `/api/runs`. NOTE: This is not the same set of runs as is shown on wpt.fyi by
   428  default.
   429  
   430  __`q`__: (Optional) A query string for search. Only results data for tests that
   431  contain the `q` value as a substring of the test name will be returned. Defaults
   432  to the empty string, which will yield all test results for the selected runs.
   433  NOTE: structured search queries are not supported.
   434  
   435  #### Examples
   436  
   437  - https://staging.wpt.fyi/api/search?run_ids=6311104602963968,5132783244541952&q=xyz
   438  
   439  <details><summary><b>Example JSON</b></summary>
   440  
   441  ```json
   442  {
   443    "runs": [
   444      {
   445        "id": 6.311104602964e+15,
   446        "browser_name": "chrome",
   447        "browser_version": "68.0.3440.106",
   448        "os_name": "linux",
   449        "os_version": "16.04",
   450        "revision": "2dda7b8c10",
   451        "full_revision_hash": "2dda7b8c10c7566fa6167a32b09c85d51baf2a85",
   452        "results_url": "https:\/\/storage.googleapis.com\/wptd-staging\/2dda7b8c10c7566fa6167a32b09c85d51baf2a85\/chrome-68.0.3440.106-linux-16.04-edf200244e-summary_v2.json.gz",
   453        "created_at": "2018-08-17T08:12:29.219847Z",
   454        "time_start": "2018-08-17T06:26:52.33Z",
   455        "time_end": "2018-08-17T07:50:09.155Z",
   456        "raw_results_url": "https:\/\/storage.googleapis.com\/wptd-results-staging\/2dda7b8c10c7566fa6167a32b09c85d51baf2a85\/chrome-68.0.3440.106-linux-16.04-edf200244e\/report.json",
   457        "labels": [
   458          "buildbot",
   459          "chrome",
   460          "stable"
   461        ]
   462      },
   463      {
   464        "id": 5.132783244542e+15,
   465        "browser_name": "firefox",
   466        "browser_version": "61.0.2",
   467        "os_name": "linux",
   468        "os_version": "16.04",
   469        "revision": "2dda7b8c10",
   470        "full_revision_hash": "2dda7b8c10c7566fa6167a32b09c85d51baf2a85",
   471        "results_url": "https:\/\/storage.googleapis.com\/wptd-staging\/2dda7b8c10c7566fa6167a32b09c85d51baf2a85\/firefox-61.0.2-linux-16.04-75ff911c43-summary_v2.json.gz",
   472        "created_at": "2018-08-17T08:31:38.580221Z",
   473        "time_start": "2018-08-17T06:47:29.643Z",
   474        "time_end": "2018-08-17T08:15:18.612Z",
   475        "raw_results_url": "https:\/\/storage.googleapis.com\/wptd-results-staging\/2dda7b8c10c7566fa6167a32b09c85d51baf2a85\/firefox-61.0.2-linux-16.04-75ff911c43\/report.json",
   476        "labels": [
   477          "buildbot",
   478          "firefox",
   479          "stable"
   480        ]
   481      }
   482    ],
   483    "results": [
   484      {
   485        "test": "\/html\/dom\/elements\/global-attributes\/lang-xyzzy.html",
   486        "legacy_status": [
   487          {
   488            "passes": 1,
   489            "total": 1
   490          },
   491          {
   492            "passes": 1,
   493            "total": 1
   494          }
   495        ]
   496      }
   497    ]
   498  }
   499  ```
   500  
   501  </details>
   502  
   503  ## Metadata results
   504  
   505  ### /api/metadata
   506  
   507  API endpoint for fetching all of the `link` metadata stored in the wpt-metadata
   508  repository, with the (normally file-sharded) data all flattened into a JSON
   509  object which is keyed by test name.
   510  
   511  This endpoint accepts POST and GET requests.
   512  
   513  - GET request returns Metadata Link Information by product, and requires product parameters;
   514  
   515  - POST request searches Metadata Link by link url, and requires product parameters and payload.
   516  
   517  __URL Parameters__
   518  
   519  __`product`__ : browser[version[os[version]]]. e.g. `chrome-63.0-linux`
   520  
   521  #### JSON Request Payload
   522  ```json
   523  [
   524    {
   525      "link": "[pattern]"
   526    }
   527  ]
   528  ```
   529  
   530    Where `[pattern]` is any substring of the url field of a wpt-metadata `link` node.
   531  
   532  #### Get Examples
   533  
   534  - /api/metadata?product=chrome&product=safari
   535  
   536  <details><summary><b>Example JSON</b></summary>
   537  
   538  ```json
   539  {
   540    "/FileAPI/blob/Blob-constructor.html": [
   541      {
   542        "url": "https://github.com/web-platform-tests/results-collection/issues/661",
   543        "product": "chrome",
   544        "results:" [
   545          {
   546            "subtest": "Blob with type \"image/gif;\"",
   547            "status": "UNKNOWN"
   548          },
   549          {
   550            "subtest": "Invalid contentType (\"text/plain\")",
   551            "status": "UNKNOWN"
   552          }
   553        ]
   554      }
   555    ],
   556    "/service-workers/service-worker/fetch-request-css-base-url.https.html": [
   557      {
   558        "url": "https://bugzilla.mozilla.org/show_bug.cgi?id=1201160",
   559        "product": "firefox",
   560      }
   561    ],
   562    "/service-workers/service-worker/fetch-request-css-images.https.html": [
   563      {
   564        "url": "https://bugzilla.mozilla.org/show_bug.cgi?id=1532331",
   565        "product": "firefox"
   566      }
   567    ]
   568  }
   569  ```
   570  </details>
   571  
   572  #### Post Examples
   573  - POST /api/metadata?product=chrome\&product=firefox \
   574      exists:='[{"link":"bugs.chromium.org"}]'
   575  
   576  <details><summary><b>Example JSON</b></summary>
   577  
   578  ```json
   579  {
   580    "/IndexedDB/bindings-inject-key.html": [
   581      {
   582        "url": "bugs.chromium.org/p/chromium/issues/detail?id=934844"
   583      }
   584    ],
   585    "/html/browsers/history/the-history-interface/007.html": [
   586      {
   587        "url": "bugs.chromium.org/p/chromium/issues/detail?id=592874"
   588      }
   589    ]
   590  }
   591  ```
   592  </details>
   593  
   594  ### /api/metadata/pending
   595  API endpoint for retrieving pending metadata whose PRs are not merged yet. This endpoint is used along with the /api/metadata endpoint to retrieve all metadata, pending or non-pending. It accepts GET requests without any parameters. It returns the same JSON response as [/api/metadata](#apimetadata).
   596  
   597  This endpoint is a best-effort API, because in some rare cases, e.g. both the Redis server and its replica go down, pending metadata information can be lost temporarily.
   598  
   599  ### /api/metadata/triage
   600  
   601  This API is available for trusted third parties.
   602  
   603  To use the Triage Metadata API, you first need to sign in to [wpt.fyi](https://wpt.fyi/) (top-right corner; 'Sign in with GitHub'). For more information on wpt.fyi login, see [here](https://docs.google.com/document/d/1iRkaK6cGgXp3DKbNbPMVsYGMaOHO-5CfqEuLPUR_2HM).
   604  
   605  The logged-in user also needs to belong to the ['web-platform-tests' GitHub organization](https://github.com/orgs/web-platform-tests/people). To join, please [file an issue](https://github.com/web-platform-tests/wpt/issues/new?), including the reason you need access to the Triage Metadata API.
   606  
   607  Once logged in, you can send a request to /api/metadata/triage to triage metadata. This endpoint only accepts PATCH requests and appends a triage JSON object to the existing Metadata YML files. The JSON object is a flattened YAML `Links` structure that is keyed by test name [Test path](https://docs.google.com/document/d/1oWYVkc2ztANCGUxwNVTQHlWV32zq6Ifq9jkkbYNbSAg/edit#heading=h.t7ysbpr8er1y); see below for an example.
   608  
   609  This endpoint returns the URL of a PR that is created in the wpt-metadata repo.
   610  
   611  <details><summary><b>Example JSON Body</b></summary>
   612  
   613  ```json
   614  {
   615    "/FileAPI/blob/Blob-constructor.html": [
   616      {
   617        "url": "https://github.com/web-platform-tests/results-collection/issues/661",
   618        "product": "chrome",
   619        "results:" [
   620          {
   621            "subtest": "Blob with type \"image/gif;\"",
   622            "status": 6
   623          },
   624          {
   625            "subtest": "Invalid contentType (\"text/plain\")",
   626            "status": 0
   627          }
   628        ]
   629      }
   630    ],
   631    "/service-workers/service-worker/fetch-request-css-base-url.https.html": [
   632      {
   633        "url": "https://bugzilla.mozilla.org/show_bug.cgi?id=1201160",
   634        "product": "firefox",
   635      }
   636    ],
   637    "/service-workers/service-worker/fetch-request-css-images.https.html": [
   638      {
   639        "url": "https://bugzilla.mozilla.org/show_bug.cgi?id=1532331",
   640        "product": "firefox"
   641      }
   642    ]
   643  }
   644  ```
   645  </details>
   646  
   647  ## Browser Specific Failure
   648  
   649  ### /api/bsf
   650  Gets the BSF data of Chrome, Firefox, Safari for the home directory.
   651  
   652  The endpoint accepts GET requests.
   653  
   654  __Parameters__
   655  
   656  __`from`__ : (Optional) RFC3339 timestamp, for which to include BSF data that occured after the given time inclusively.
   657  
   658  __`to`__ : (Optional) RFC3339 timestamp, for which to include BSF data that occured before the given time exclusively.
   659  
   660  __`experimental`__ : A boolean to return BSF data for experimental or stable runs. Defaults to false.
   661  
   662  __JSON Response__
   663  
   664  The response has three top-level fields:
   665  
   666  `lastUpdateRevision` indicates the latest WPT Revision updated in `data`.
   667  
   668  `fields` corresponds to the fields (columns) in the `data` table and has the format of an array of:
   669  
   670  - sha, date, [product-version, product-score]+
   671  
   672  `data` returns BSF data in chronological order.
   673  
   674  <details><summary><b>Example JSON</b></summary>
   675  
   676  ```json
   677  {
   678     "lastUpdateRevision":"eea0b54014e970a2f94f1c35ec6e18ece76beb76",
   679     "fields":[
   680        "sha",
   681        "date",
   682        "chrome-version",
   683        "chrome",
   684        "firefox-version",
   685        "firefox",
   686        "safari-version",
   687        "safari"
   688     ],
   689     "data":[
   690        [
   691           "eea0b54014e970a2f94f1c35ec6e18ece76beb76",
   692           "2018-08-07",
   693           "70.0.3510.0 dev",
   694           "602.0505256721168",
   695           "63.0a1",
   696           "1617.1788882804883",
   697           "12.1",
   698           "2900.3438625831423"
   699        ],
   700        [
   701           "203c34855f6871d6e55eaf7b55b50dad563f781f",
   702           "2018-08-18",
   703           "70.0.3521.2 dev",
   704           "605.3869030161061",
   705           "63.0a1",
   706           "1521.908686731921",
   707           "12.1",
   708           "2966.686195133767"
   709        ]
   710     ]
   711  }
   712  ```
   713  </details>
   714  
   715  ## Test History
   716  
   717  ### /api/history
   718  
   719  This endpoint accepts POST requests. It returns historical test run information for a given test name.
   720  
   721  #### JSON Request Payload
   722  ```json
   723  {
   724      "test_name": "example test name"
   725  }
   726  ```
   727  #### JSON Response
   728  The returned JSON will contain a history of test runs for each major browser: Chrome, Firefox, Edge, and Safari.
   729  
   730  Each individual subtest run will have a `date`, `status`, and `run_id`.
   731  
   732  The first test entry for each browser is represented with an empty string. This represents the `Harness Status` if there are multiple tests, or the `Test Status` if there is only one test.
   733  
   734  <details><summary><b>Example JSON</b></summary>
   735  
   736  ```json
   737  {
   738      "results": {
   739          "chrome": {
   740              "": [
   741                  {
   742                      "date": "2022-06-02T06:02:55.000Z",
   743                      "status": "TIMEOUT",
   744                      "run_id": "5074677897101312"
   745                  }
   746              ],
   747              "subtest_name_1": [
   748                  {
   749                      "date": "2022-06-02T06:02:55.000Z",
   750                      "status": "PASS",
   751                      "run_id": "5074677897101312"
   752                  }
   753              ]
   754          },
   755          "firefox": {
   756              "": [
   757                  {
   758                      "date": "2022-06-02T06:02:55.000Z",
   759                      "status": "OK",
   760                      "run_id": "5074677897101312"
   761                  }
   762              ],
   763              "subtest_name_1": [
   764                  {
   765                      "date": "2022-06-02T06:02:55.000Z",
   766                      "status": "PASS",
   767                      "run_id": "5074677897101312"
   768                  }
   769              ]
   770          }
   771      }
   772  }
   773  ```
   774  </details>