Page MenuHomeSoftware Heritage
Paste P815

deposit client query update to actually update metadata on deposit done
ActivePublic

Authored by ardumont on Oct 9 2020, 3:31 PM.
# client side
$ SWH_CREDS="swh:<creds>"
$ DEPOSIT_ID=605
$ SWHID="swh:1:dir:ef04a768181417fbc5eef4243e2507915f24deea"
# check status is fine
$ curl -u $SWH_CREDS "https://deposit.staging.swh.network/1/swh/$DEPOSIT_ID/status/"
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:sword="http://purl.org/net/sword/"
xmlns:dcterms="http://purl.org/dc/terms/">
<deposit_id>605</deposit_id>
<deposit_status>done</deposit_status>
<deposit_status_detail>The deposit has been successfully loaded into the Software Heritage archive</deposit_status_detail>
<deposit_swh_id>swh:1:dir:ef04a768181417fbc5eef4243e2507915f24deea</deposit_swh_id>
<deposit_swh_id_context>swh:1:dir:ef04a768181417fbc5eef4243e2507915f24deea;origin=https://www.softwareheritage.org/check-deposit-2020-05-14T08:28:05.683282;visit=swh:1:snp:4577ab1375d35bab6e3165f3ebfddb745b57ee98;anchor=swh:1:rev:a17e7bde68bcbf6f500ea89c8c34d1c6eebfef4f;path=/</deposit_swh_id_context>
<deposit_external_id>check-deposit-2020-05-14T08:28:05.683282</deposit_external_id>
</entry>
$ file deposit-hal-preprod.xml # some metadata file
deposit-hal-preprod.xml: XML 1.0 document, ASCII text
# actual request to update the deposit metadata
$ curl -XPUT -u $SWH_CREDS -H "Content-Type: application/atom+xml;type=entry" -H "X_CHECK_SWHID: $SWHID" --data-binary @deposit-hal-preprod.xml "https://deposit.staging.swh.network/1/swh/$DEPOSIT_ID/metadata/
# server side (it replied "fine")
```
Oct 09 13:12:23 deposit python3[916]: 2020-10-09 13:12:23 [916] gunicorn.access:INFO 127.0.0.1 - swh [09/Oct/2020:13:12:23 +0000] "PUT /1/swh/605/metadata/ HTTP/1.1" 204 0 "-" "curl/7.64.0"
```

Event Timeline

With deposit >= v0.7.0:

curl -XPUT -u $SWH_CREDS -H "Content-Type: application/atom+xml;type=entry" -H "X_CHECK_SWHID: $SWHID" --data-binary @deposit-hal-preprod.xml "https://deposit.staging.swh.network/1/swh/$DEPOSIT_ID/atom/