Package ch.ivyteam.ivy.rest.client
Interface IRestClientContext
public interface IRestClientContext
REST clients of this application. Use the REST clients editor to configure a new REST client and then access it with client(String) or client(UUID)
Example:
String response = ivy.rest.client("myRestClient").request().get().readEntity(String.class) as String;
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.client.WebTargetGets the REST client with the given name.javax.ws.rs.client.WebTargetDeprecated, for removal: This API element is subject to removal in a future version.static IRestClientContextcurrent()Gets the current rest client context.getIds()Deprecated, for removal: This API element is subject to removal in a future version.usegetKeys()insteadgetKeys()Gets a list with the key identifiers of all available rest clientsgetNames()Deprecated, for removal: This API element is subject to removal in a future version.usegetKeys()instead
-
Method Details
-
client
Gets the REST client with the given name.
Example:
String response = ivy.rest.client("myRestClient").request().get().readEntity(String.class) as String;- Parameters:
name-- Returns:
- client
- Throws:
NoSuchElementException- if REST client with the given name or id does not exist- API:
- This public API is available in Java.
-
client
@Deprecated(since="12.0.14", forRemoval=true) javax.ws.rs.client.WebTarget client(UUID id) throws NoSuchElementException Deprecated, for removal: This API element is subject to removal in a future version.useclient(String)insteadGets the REST client with the given unique identifier.
Examples:
import java.util.UUID; UUID uuid = UUID.fromString("e00c9735-7733-4da8-85c8-6413c6fb2cd2"); String response = ivy.rest.client(uuid).request().get().readEntity(String.class) as String;- Parameters:
id- unique identifier- Returns:
- client
- Throws:
NoSuchElementException- if REST client with the given id does not exist- API:
- This public API is available in Java.
-
getKeys
Gets a list with the key identifiers of all available rest clients- Returns:
- list of rest client identifiers
- API:
- This public API is available in Java.
-
getNames
Deprecated, for removal: This API element is subject to removal in a future version.usegetKeys()insteadGets a list with the names of all available rest clients- Returns:
- list of rest client names
- API:
- This public API is available in Java.
-
getIds
Deprecated, for removal: This API element is subject to removal in a future version.usegetKeys()insteadGets a list with the unique identifiers of all available rest clients- Returns:
- list of rest client identifiers
- API:
- This public API is available in Java.
-
current
Gets the current rest client context.
Will return null if called out of scope. The scope is set if you call this method from an ivy process or any supported ivy environment. It is not set in non supported ivy environments (e.g. if you start your own threads, etc.).
- Returns:
- current rest client context or null if out of scope
- Since:
- 9.1
- API:
- This public API is available in Java.
-
client(String)instead