...
Codeblock |
---|
title | Antwort auf GET /namespaces/name/urn:nbn:de:example |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 656
Date: Wed, 13 Feb 2019 14:10:41 GMT
{
"name": "urn:nbn:de:example",
"creationDatecreated": "2019-02-13T15:08:55+0100.123Z",
"lastModified": "2019-02-13T15:08:55+0100.123Z",
"allowsRegistration": true,
"organisationowner": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
"urnNamingPolicy": "https://api.nbn-resolving.org/sandbox/v2/policies/urn-naming/id/no-check",
"urlPolicy": "https://api.nbn-resolving.org/sandbox/v2/policies/url/id/no-check",
"comment": null,
"resolverUrl": "",
"urns": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urns",
"urnSuggestion": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urn-suggestion",
"@idself": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example"
} |
...
Codeblock |
---|
title | Antwort auf GET /namespaces/name/urn:nbn:de:example/urn-suggestion |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 233
Date: Wed, 13 Feb 2019 14:15:52 GMT
{
"suggestedUrn": "urn:nbn:de:example-2019021315155244513532",
"namespace": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example",
"@idself": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urn-suggestion"
} |
...
Die Angabe der priority
ist optional. Sie bestimmt bei mehreren URLs in welcher Reihenfolge sie beim Resolving berücksichtigt werden. URLs mit höherer Priorität (d.h einer größeren Zahl) werden vorrangig verwendet (Hinweis: Dies ist im aktuellen NBN-Resolver auf https://nbn-resolving.org/ noch nicht vollständig umgesetzt).
Info |
---|
Das Konzept Priority/Primary wird aktuell bearbeitet. Bitte markieren Sie ausschließlich die am höchsten priorisierte URL mit dem Wert "1". |
Codeblock |
---|
POST /sandbox/v2/urns
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
{
"urn": "urn:nbn:de:example-2019021315155244513532",
"urls": [
{
"url": "http://example.org/document-url",
"priority": 10
}
]
} |
...
Codeblock |
---|
title | Antwort auf POST /sandbox/v2/urns |
---|
collapse | true |
---|
|
HTTP/1.1 201 Created
Connection: keep-alive
Location: httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532
Content-Type: application/json
Content-Length: 527
Date: Wed, 13 Feb 2019 14:32:48 GMT
{
"urn": "urn:nbn:de:example-2019021315155244513532",
"creationDatecreated": "2019-02-13T15:32:48+0100.123Z",
"lastModified": "2019-02-13T15:32:48+0100.123Z",
"namespace": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example",
"successor": null,
"urls": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls",
"myUrls": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls",
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532"
} |
...
Mithilfe der URLs in den Feldern @id
,
urls
, myUrls
können wir jetzt leicht weitere Abfragen auf der URN vornehmen.
...
Codeblock |
---|
title | Antwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532 |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 527
Date: Wed, 13 Feb 2019 14:50:27 GMT
{
"urn": "urn:nbn:de:example-2019021315155244513532",
"creationDatecreated": "2019-02-13T15:32:48+0100.123Z",
"lastModified": "2019-02-13T15:32:48+0100.123Z",
"namespace": "https://api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example",
"successor": null,
"urls": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls",
"myUrls": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls",
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532"
} |
...
Codeblock |
---|
title | Antwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 573
Date: Wed, 13 Feb 2019 14:53:08 GMT
{
"totalItems": 1,
"items": [
{
"url": "http://example.org/document-url",
"creationDatecreated": "2019-02-13T15:32:48+0100.123Z",
"lastModified": "2019-02-13T15:32:48+0100.123Z",
"urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
"organisationowner": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
"priority": 10,
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA=="
}
],
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls"
} |
...
Codeblock |
---|
title | Antwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 576
Date: Wed, 13 Feb 2019 14:56:02 GMT
{
"totalItems": 1,
"items": [
{
"url": "http://example.org/document-url",
"creationDatecreated": "2019-02-13T15:32:48+0100.123Z",
"lastModified": "2019-02-13T15:32:48+0100.123Z",
"urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
"organisationowner": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
"priority": 10,
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA=="
}
],
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls"
} |
...
Codeblock |
---|
title | Antwort auf GET sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA== |
---|
collapse | true |
---|
|
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Content-Length: 449
Date: Wed, 13 Feb 2019 15:01:21 GMT
{
"url": "http://example.org/document-url",
"creationDatecreated": "2019-02-13T15:32:48+0100.123Z",
"lastModified": "2019-02-13T15:32:48+0100.123Z",
"urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
"organisationowner": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
"priority": 10,
"@idself": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA=="
} |
Hinzufügen einer URL zu einer URN
Löschen einer URL von einer URN
Aktualisieren der Priorität einer URL
Austauschen aller eigenen URLs an einer URN
Nachfolger einer URN setzen
...
Um eine zusätzliche URL zu einer URN zu registrieren, kann ein POST
-Request auf den Endpunkt /urns/urn/<urn>/urls
gemacht werden. Zusätzliche URLs dürfen nicht nur an eigenen URNs registriert werden, sondern an beliebigen URNs. Die Angabe des Feldes priority
ist wieder optional.
Codeblock |
---|
POST /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
{
"url" : "http://example.org/another-document-url",
"priority" : 100
} |
Codeblock |
---|
title | Antwort auf POST /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls |
---|
collapse | true |
---|
|
HTTP/1.1 201 Created
Connection: keep-alive
Location: https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs
Content-Type: application/json
Content-Length: 466
Date: Wed, 13 Feb 2019 15:11:15 GMT
{
"url": "http://example.org/another-document-url",
"created": "2019-02-13T16:11:15.123Z",
"lastModified": "2019-02-13T16:11:15.123Z",
"urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
"owner": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
"priority": 100,
"self": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs"
} |
Als Antwort auf das Anlegen einer neuen URL wird der Status 201 Created
zurückgegeben und die Beschreibung der neuen URL zurückgegeben.
Aktualisieren der Priorität einer URL (Da das Konzept der Priority gerade überarbeitet wird, wird diese Funktion zukünftig nicht mehr benötigt!)
Um die Priorität einer URL zu ändern, kann ein PATCH
-Request auf die jeweilige URL-Ressource unter dem Endpunkt-Muster /urns/urn/<urn>/urls/base64/<url-in-base64>
gemacht werden.
Codeblock |
---|
PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
{
"priority" : 3
} |
Codeblock |
---|
title | Antwort auf PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs |
---|
collapse | true |
---|
|
HTTP/1.1 204 No Content
Date: Wed, 13 Feb 2019 15:16:10 GMT
<Response body is empty> |
Wenn die Änderung der Priorität erfolgreich durchgeführt wurde, liefert die API den Status 204 No Content
zurück.
Löschen einer URL von einer URN
Soll eine URL von einer URN gelöscht werden, so geschieht dies über einen DELETE
-Request auf die URL-Referenz /urns/urn/<urn>/urls/base64/<url-in-base64>
. Dabei können selbstverständlich nur die eigenen URLs gelöscht werden. Außerdem muss mindestens eine URL an der URN registriert bleiben. Wenn die eigene die letzte URL an einer URN ist, kann sie nicht entfernt werden.
Codeblock |
---|
DELETE /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Accept: application/json |
Codeblock |
---|
title | Antwort auf DELETE /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2Fub3RoZXItZG9jdW1lbnQtdXJs |
---|
collapse | true |
---|
|
HTTP/1.1 204 No Content
Date: Wed, 13 Feb 2019 15:22:20 GMT
<Response body is empty> |
Das erfolgreiche Löschen wir durch den Status 204 No Content
zurückgemeldet.
Austauschen aller eigenen URLs an einer URN
Neben dem Hinzufügen und Löschen einzelner URLs bietet die URN-Service API auch die Möglichkeit, alle eigenen URLs durch neue URLs zu ersetzen. Dies geschieht über einen PATCH
-Request an den Endpunkt /urns/urn/<urn>/my-urls
. Der Request muss eine Liste der neuen URLs enthalten. Diese können sich auch teilweise mit den Existierenden überschneiden, falls nur ein Teil der URLs verändert werden soll. Im folgenden Beispiel, soll die existierende URL beibehalten werden, daher ist sie in der Liste enthalten. Zusätzlich registrieren wir eine neue URL. Dabei verzichten wir auf die Angabe der Priorität, sodass die URL die Priorität 0 erhält.
Codeblock |
---|
PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
[
{
"url": "http://example.org/document-url",
"priority": 23
},
{
"url": "http://example.org/additional-document-url"
}
] |
Codeblock |
---|
title | Antwort auf PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls |
---|
collapse | true |
---|
|
HTTP/1.1 204 No Content
Date: Fri, 15 Feb 2019 15:24:18 GMT
<Response body is empty> |
Nachfolger einer URN setzen
In seltenen Fällen kann es vorkommen, dass eine URN durch eine Nachfolge-URN ersetzt werden soll. Beim Resolving soll dann automatisch von der alten URN zum Nachfolger weitergeleitet werden. URN-Besitzer können diese Nachfolger-Beziehung einrichten. Dies geschieht über einen PATCH
-Request auf due URN-Ressource /urns/urn/<urn>
. Die Nachfolger-URN wird über ihren kanonischen API-Referenz identifiziert, der im @id
-Feld jeder URN enthalten ist:
Codeblock |
---|
PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
{
"successor": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-20190213151552346346245"
} |
Codeblock |
---|
title | Antwort auf PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532 |
---|
collapse | true |
---|
|
HTTP/1.1 204 No Content
Date: Wed, 13 Feb 2019 15:40:34 GMT
<Response body is empty> |
Das erfolgreiche Setzen der Nachfolge-URN wird mit dem Status 204 No Content
quittiert.
Nachfolger einer URN entfernen
Falls ein Nachfolge-URN fälscherlicher Weise gesetzt wurde, kann sie einfach wieder entfernt werden, indem ein PATCH
-Request mit einem null
-Wert als Nachfolger gesendet wird:
Codeblock |
---|
PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Content-Type: application/json
Accept: application/json
{
"successor": null
} |
Codeblock |
---|
title | Antwort auf PATCH /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532 |
---|
collapse | true |
---|
|
HTTP/1.1 204 No Content
Date: Wed, 13 Feb 2019 15:43:28 GMT
<Response body is empty> |
Das erfolgreiche Löschen der Nachfolge-URN wird mit dem Status 204 No Content
bestätigt.