Versionen im Vergleich

Schlüssel

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

...

UrnNamespaceRestClient

Entry point for the users of the URN client to access the RESTNamespaceResources.

UrnOrganisationRestClient

Entry point for the users of the URN client to access the RESTOrganisationResource.

UrnPoliciesRestClient

Entry point for the users of the URN client to access the RESTPoliciesResource.

UrnRestClient

Entry point for the users of the URN client to get information via RESTApiInfoResource about the URn-REST-API.

UrnUrnRestClient

Handles the task of making the connections and the requests to the Urn-Service's RestApi.

Schritt-für-Schritt-Anleitung

Technische Voraussetzungen:

  • Die Verwendung von Java 8 oder kompatiblere JVM Sprache in der entsprechenden Version.
  • Berechtigung zur Einspielung von URNS der eigenen Institutionen innerhalb des eigenen Namensraumes in Form von LOGIN / USER Credentials.
  • Die URL zur URN-Rest-API (z.B.: "http://api.nbn-resolving.org/sandbox/v2/").

Implementierungen

UrnRestClient


Codeblock
languagejava
themeEclipse
private static final String V2_URI = "http://api.nbn-resolving.org/sandbox/v2/";

private static UrnRestClient urnRepository;

public static void main(String[] args) {

 	urnRepository = new UrnRestClient(V2_URI); 
	final ApiInfo info = urnRepository.getInfo();
}

...

Codeblock
languagejava
themeEclipse
titleupdateUrl()
private static final String V2_URI = "http://api.nbn-resolving.org/sandbox/v2/";
private static final String ORG_ID = "19066";
private static final String URN_NAME = "urn:nbn:de:0007-2307251300155.775903492814";
private static UrnUrnRestClient urnUrnRepository;

public static void main(String[] args) {
 	    URI uriEins = null;
        URI orgaId = null;
        URI uriZwei = null;
       
        try {
            uriEins = new URI("https://testUri/forClient/repl_1".pdf");
            uriZwei = new URI("https://testUri/forClient/repl_2".docx");
            orgaId = new URI(V2_URI + "organisations/id/" + ORG_ID);
        } catch (final URISyntaxException e) {
            System.out.println("URI Syntax not conform to RFC.");
        }

        final List<RESTReplaceUrlRequest> allMyUrls = new ArrayList<RESTReplaceUrlRequest>();

        final RESTReplaceUrlRequest eins = new RESTReplaceUrlRequest();
        eins.setUrl(uriZwei);
        eins.setPriority(1);

        final RESTReplaceUrlRequest zwei = new RESTReplaceUrlRequest();
        zwei.setUrl(uriDrei);
        zwei.setPriority(0);

        allMyUrls.add(eins);
        allMyUrls.add(zwei);

        UrnRestResultObject restCallresponse = null;
        try {
            restCallresponse = urnUrnRepository.updateUrl(ORG_LOGIN, ORG_PASSWORD, URN_NAME , allMyUrls,
                    "");
        } catch (final UrnRestApiNotAvailableException e) {
            System.out.println("The client cannot connect to the URN-REST-API.");
        }


}


Diese Anfrage liefert lediglich ein Ergebnisobjekt vom Typ UrnRestResultObject. In diesem besonderen Fall werden lediglich Information darüber zurückgegeben, ob der Request erfolgreich war.

...