Skip to content

Commit

Permalink
Add an api/external endpoint that lists the external services we use.
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalchevrel committed May 5, 2024
1 parent 2520d1c commit df97883
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/classes/ReleaseInsights/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function getController(): string
'/about/' => 'about',
'/nightly/' => 'nightly',
'/release/' => 'release',
'/api/external/' => 'api/external',
'/api/nightly/' => 'api/nightly',
'/api/release/schedule/' => 'api/release_schedule',
'/api/esr/releases/' => 'api/esr_releases',
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/api/external.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

$json = include MODELS . 'api/external.php';

ReleaseInsights\Utils::renderJson($json);
4 changes: 4 additions & 0 deletions app/models/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<td><a href="/api/nightly/?date={$yesterday}">api/nightly/?date={$yesterday}</a></td>
<td>Provides the list of nightly build IDs for a day and the changeset they were built from (data from buildhub)</td>
</tr>
<tr>
<td><a href="/api/external/">api/external/</a></td>
<td>Gives the list of external APIs this site depends on to build data.</td>
</tr>
<tr>
<td><a href="/api/nightly/crashes/?buildid=20190927094817">api/nightly/crashes/?buildid=20190927094817</a></td>
<td>Gives the crashes for a buildID (data from Socorro)</td>
Expand Down
5 changes: 5 additions & 0 deletions app/models/api/external.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

return ReleaseInsights\URL::cases();
1 change: 1 addition & 0 deletions tests/Functional/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Those tests mostly check that our public API works
$paths = [
['external/', 200, 'Verif:skip'],
['nightly/?date=20220101&nocache', 200, '{"20220101095322":"521f2f0038436e8f0a83146ea6c32eb419049b57","20220101231829":"1fe0ce6b31654726691145ca9dc5f2f15114316c"}'],
['release/schedule/?version=95', 400, '{
"error": "API only works with future release."
Expand Down

0 comments on commit df97883

Please sign in to comment.