Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
titleAntwort auf GET /namespaces/name/urn:nbn:de:example
collapsetrue
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",
  "creationDate": "2019-02-13T15:08:55+0100",
  "lastModified": "2019-02-13T15:08:55+0100",
  "allowsRegistration": true,
  "organisation": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/organisations/id/1",
  "urnNamingPolicy": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/policies/urn-naming/id/no-check",
  "urlPolicy": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/policies/url/id/no-check",
  "comment": null,
  "resolverUrl": "",
  "urns": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urns",
  "urnSuggestion": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urn-suggestion",
  "@id": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example"
}

...

Codeblock
titleAntwort auf GET /namespaces/name/urn:nbn:de:example/urn-suggestion
collapsetrue
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": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example",
  "@id": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example/urn-suggestion"
}

...

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
titleAntwort auf POST /sandbox/v2/urns
collapsetrue
HTTP/1.1 201 Created
Connection: keep-alive
Location: http://localhost:8080/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",
  "creationDate": "2019-02-13T15:32:48+0100",
  "lastModified": "2019-02-13T15:32:48+0100",
  "namespace": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/namespaces/name/urn:nbn:de:example",
  "successor": null,
  "urls": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls",
  "myUrls": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls",
  "@id": "httphttps://localhost:8080api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532"
} 

...

Um zu Überprüfen, ob eine URN registriert wurde, können wir einfach einen HEAD-Request auf den Endpunkt Endpunkt /urns/urn/<urn> machen. Wenn die URN existiert, wird der Status 200 OK zurückgegeben:

...

Codeblock
HEAD /sandbox/v2/urns/urn/urn:nbn:de:example-nicht-registriert
Codeblock
titleAntwort auf HEAD /sandbox/v2/urns/urn/urn:nbn:de:example-nicht-registriert
collapsetrue
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Type: application/json
Content-Length: 67
Date: Wed, 13 Feb 2019 14:44:45 GMT

<Response body is empty>

URN abfragen

Statt nur die Existenz einer URN über die API zu erfragen, können per GET-Request auf den Endpunkt /urns/urn/<urn> auch Informationen zu einer registrierten URN abgefragt werden.

Codeblock
GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532
Accept: application/json
Codeblock
titleAntwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532
collapsetrue
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",
  "creationDate": "2019-02-13T15:32:48+0100",
  "lastModified": "2019-02-13T15:32:48+0100",
  "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",
  "@id": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532"
} 

URLs an einer URN abfragen

Über den Link im Feld urls, dass wir bei der URN-Abfrage erhalten haben, können wir uns eine Liste aller URLs ausgeben lassen, die für die URN registriert sind:

Codeblock
GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls
Accept: application/json
Codeblock
titleAntwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls
collapsetrue
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",
      "creationDate": "2019-02-13T15:32:48+0100",
      "lastModified": "2019-02-13T15:32:48+0100",
      "urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
      "organisation": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
      "priority": 10,
      "@id": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA=="
    }
  ],
  "@id": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls"
} 

Eigene URLs an einer URN abfragen

Statt alle registrierten URLs abzufragen, können wir auch den Link aus dem Feld myUrls aus der URN-Abfrage verwenden, um nur die URLs aufzulisten die uns gehören. Dies funktioniert natürlich nur, wenn wir Authentizierungsdaten in der Anfrage mitsenden. Die Liste ist entsprechend der Priorität unserer URLs sortiert. Falls wir keine URLs an einer URN registriert haben, bekommen wir eine leere Liste zurück.

Codeblock
GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls
Authorization: Basic dXJuLXBhcnRuZXI6bWVpbi1wYXNzd29ydA==
Accept: application/json
Codeblock
titleAntwort auf GET /sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls
collapsetrue
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",
      "creationDate": "2019-02-13T15:32:48+0100",
      "lastModified": "2019-02-13T15:32:48+0100",
      "urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
      "organisation": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
      "priority": 10,
      "@id": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA=="
    }
  ],
  "@id": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/my-urls"
}

Da nur eine URL zu unserer Beispiel-URN registriert ist, erhalten wir dieselbe Liste wie bei der Abfrage aller URLs.

Einzelne URL abfragen

Statt alle URLs an einer URN abzufragen, können wir auch gezielt eine einzelne URL abfragen. Dazu kann ein GET-Request auf den Endpunkt /urns/urn/<urn>/urls/base64/<url-in-base64> gemacht werden. Da eine URL nicht einfach als Teil einer anderen URL verwendet werden kann, muss die URL im Format Base 64 kodiert werden.

Codeblock
GET sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA==
Accept: application/json
Codeblock
titleAntwort auf GET sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532/urls/base64/aHR0cDovL2V4YW1wbGUub3JnL2RvY3VtZW50LXVybA==
collapsetrue
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",
  "creationDate": "2019-02-13T15:32:48+0100",
  "lastModified": "2019-02-13T15:32:48+0100",
  "urn": "https://api.nbn-resolving.org/sandbox/v2/urns/urn/urn:nbn:de:example-2019021315155244513532",
  "organisation": "https://api.nbn-resolving.org/sandbox/v2/organisations/id/1",
  "priority": 10,
  "@id": "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

Nachfolger einer URN entfernen