...
| Codeblock | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
private static final String V2_URI = "http://api.nbn-resolving.org/sandbox/v2/";
private static final String DEFAULT_NASP_WILDCARD = "urn:nbn:de*";
private static final String ORG_NAMESPACE = "urn:nbn:de:0007";
private static UrnNamespaceRestClient naspRepository;
public static void main(String[] args) {
naspRepository = new UrnNamespaceRestClient(V2_URI);
UrnRestResultNamespaceObject result = null;
try {
result = naspRepository.getNamespaceViaName(ORG_LOGIN, ORG_PASSWORD, ORG_NAMESPACE, ORG_USER);
} catch (final UrnRestApiNotAvailableException e) {
LOGGERSystem.out.errorprintln("The client cannot connect to the server. Is there an internet connection?URN-REST-API.");
}
LOGGER.info("Response End...");
} |
...
| Info | ||
|---|---|---|
| ||
[main] INFO de.dnb.resolvingdienste.urn.restapi.client.testurnclient.mainForTest - getNamespace()... |
UrnOrganisationClient
getOrganisationById()
Führt eine Suche nach einer bestimmten Organisation durch.
Notwendige Parameter sind wieder ORG_LOGIN, ORG_PASSWORD, Identifier der zu suchenden Organisation. Der letzte Parameter ist nur für Admins relevant (runAs) und kann leer bleiben.
| Codeblock | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
private static final String V2_URI = "http://api.nbn-resolving.org/sandbox/v2/";
private static UrnOrganisationRestClient orgRepository;
public static void main(String[] args) {
orgRepository = new UrnOrganisationRestClient(V2_URI);
UrnRestResultOrganisationObject resultObject = null;
try {
resultObject = orgRepository.getOrganisationByLogin(ORG_USER, ORG_PASSW, ORG_USER, ORG_USER);
} catch (final UrnRestApiNotAvailableException e) {
System.out.println("The client cannot connect to the URN-REST-API.");
}
} |
Diese Anfrage liefert der Einfachheit halber ein Ergebnisobjekt vom Typ UrnRestResultOrganisationObject zurück. Das eigentliche Ergebnis ist vom Typ RESTOrganisationRepresentation. Das UrnRestResultOrganisationObject "wrapt" das ursprüngliche RESTOrganisationRepresentation -Objekt und fügt weitere Informationen hinzu (Anfrage erfolgreich, Statuscode)
| Info | ||
|---|---|---|
| ||
[main] INFO de.dnb.resolvingdienste.urn.restapi.client.testurnclient.mainForTest - getUrn()... |
...