...
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 RESTOrganisationRepresentationObjekt ursprüngliche RESTOrganisationRepresentationObjekt und fügt weitere Informationen hinzu (Anfrage erfolgreich, Statuscode).
Gut zu sehen, ist der Umstand, dass man als Nicht-Admin oder NIchtNicht-Besitzer der Organisation nur eine eingeschränkte Sicht auf die Informationen hat (null-Werte).
Info | ||
---|---|---|
| ||
[main] INFO de.dnb.resolvingdienste.urn.restapi.client.testurnclient.mainForTest - getOrganisationByID()... |
...
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
private static final String V2_URI = "http://api.nbn-resolving.org/sandbox/v2/"; private static UrnOrganisationRepository orgRepository; public static void main(String[] args) { orgRepository = new UrnOrganisationRestClient(V2_URI); final Optional<OrganisationFilter> orgFilter = Optional .of(new OrganisationFilter(OrganisationFilterKey.NAME, "Test*")); UrnRestResultOrganisationObject resultObject = null; try { resultObject = orgRepository.getOrganisationsWithParams(ORG_USERLOGIN , ORG_PASSWPASSWORD , orgFilter, new OrganisationSortParameters(), new PagingParameters()); } catch (final UrnRestApiNotAvailableException e) { LOGGER.error("The client cannot connect to the server. Is there an internet connection?"); } } |
...