...
Codeblock | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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==" } |
...
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 http:/sandbox/localhost:8080/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 | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 201 Created Connection: keep-alive Location: httphttps://localhost:8080api.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", "creationDatecreated": "2019-02-13T16:11:15+0100.123Z", "lastModified": "2019-02-13T16:11:15+0100.123Z", "urn": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532", "organisationowner": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/organisations/id/1", "priority": 100, "@idself": "httphttps://localhost:8080api.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.
...
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. Allerdings verändern wir ihre Priorität. 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 | ||||
---|---|---|---|---|
| ||||
(!) Server error (Upps!) 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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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.