Page MenuHomeSoftware Heritage

Add API endpoint to get the list of metadata authorities on an origin from its URL
ClosedPublic

Authored by vlorentz on Jul 13 2022, 10:27 AM.

Details

Summary

which redirects to the 'proper' one based on extended SWHIDs.

It is more convenient for debugging than computing URL hashes;
and it will also be used in a template (which cannot really compute
SWHID, and would need non-trivial refactoring to get access to it)

Depends on D8114.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jul 13 2022, 10:28 AM
Harbormaster failed remote builds in B30415: Diff 29337!

Build is green

Patch application report for D8119 (id=29337)

Could not rebase; Attempt merge onto 6f9d36afe4...

Merge made by the 'recursive' strategy.
 swh/web/api/utils.py                     |  8 ++-
 swh/web/api/views/metadata.py            | 83 ++++++++++++++++++++++++++++---
 swh/web/api/views/origin.py              |  4 ++
 swh/web/tests/api/test_utils.py          | 21 +++++++-
 swh/web/tests/api/views/test_metadata.py | 84 ++++++++++++++++++++++++++------
 5 files changed, 175 insertions(+), 25 deletions(-)
Changes applied before test
commit 8c40ec94f41286bb090caad8f1ab84d76c1ea19f
Merge: 6f9d36af 24447070
Author: Jenkins user <jenkins@localhost>
Date:   Wed Jul 13 08:28:26 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 24447070e36505448d9a5e045a662c4cf24affd4
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jul 13 10:27:10 2022 +0200

    Add API endpoint to get the list of metadata authorities on an origin from its URL
    
    which redirects to the 'proper' one based on extended SWHIDs.
    
    It is more convenient for debugging than computing URL hashes;
    and it will also be used in a template (which cannot really compute
    SWHID, and would need non-trivial refactoring to get access to it)

commit 35938690e3a98cbefe8ea23e63254d4d8c9eb44e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 12 13:49:37 2022 +0200

    Add support for querying raw-extrinsic-metadata for origins
    
    It is purposefully discouraged to query the api-1-raw-extrinsic-metadata-swhid
    endpoint directly, as extended SWHIDs should not be part of the public API.
    
    Instead, clients should query api-1-origin first, and rely on the link
    in its response to fetch metadata.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1930/ for more details.

Build is green

Patch application report for D8119 (id=29338)

Could not rebase; Attempt merge onto 6f9d36afe4...

Updating 6f9d36af..82e885e1
Fast-forward
 swh/web/api/utils.py                     |  8 ++-
 swh/web/api/views/metadata.py            | 83 ++++++++++++++++++++++++++++---
 swh/web/api/views/origin.py              |  4 ++
 swh/web/tests/api/test_utils.py          | 21 +++++++-
 swh/web/tests/api/views/test_metadata.py | 84 ++++++++++++++++++++++++++------
 5 files changed, 175 insertions(+), 25 deletions(-)
Changes applied before test
commit 82e885e10bcd1ff93e50f3fbe30389192e642ec4
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jul 13 10:27:10 2022 +0200

    Add API endpoint to get the list of metadata authorities on an origin from its URL
    
    which redirects to the 'proper' one based on extended SWHIDs.
    
    It is more convenient for debugging than computing URL hashes;
    and it will also be used in a template (which cannot really compute
    SWHID, and would need non-trivial refactoring to get access to it)

commit b76a3cec0dc71bd46a6c3f89dc26f00734b6a706
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 12 13:49:37 2022 +0200

    Add support for querying raw-extrinsic-metadata for origins
    
    It is purposefully discouraged to query the api-1-raw-extrinsic-metadata-swhid
    endpoint directly, as extended SWHIDs should not be part of the public API.
    
    Instead, clients should query api-1-origin first, and rely on the link
    in its response to fetch metadata.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1931/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me.

This revision is now accepted and ready to land.Jul 13 2022, 10:52 AM