public class APIConnectClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
APIConnectClient.APIInfo
Nested class used to parse the JSON response from the retrieve API
APIConnect API.
|
static class |
APIConnectClient.Catalog
Internal class used to parse the JSON response from the retrieve
Environments APIConnect API.
|
class |
APIConnectClient.FlexibleBasicAuthentication
Overrides the BasicAuthentication class provided by the Jetty http
client.
|
static class |
APIConnectClient.Organization
Internal class used to parse the JSON response from the retrieve
Organizations APIConnect API.
|
static class |
APIConnectClient.ProductSummary
Internal class used to parse the JSON response from the retrieve Draft
Products APIConnect API.
|
static class |
APIConnectClient.StagedProductSummary
Internal class used to parse the JSON response from the retrieve Staged
Products APIConnect API.
|
Constructor and Description |
---|
APIConnectClient(java.lang.String hostname,
int port,
java.lang.String userId,
java.lang.String password)
APIConnectClient constructor
This method is called to create the APIConnectClient object which is
used to send REST request to APIConnect.
|
APIConnectClient(java.lang.String hostname,
int port,
java.lang.String userId,
java.lang.String password,
java.util.Properties properties)
APIConnectClient constructor
This method is called to create the APIConnectClient object which is
used to send REST request to APIConnect.
|
Modifier and Type | Method and Description |
---|---|
APIConnectClient.APIInfo |
createDraftAPI(java.lang.String orgId,
java.lang.String apiProtocol,
java.lang.String apiHost,
Api api)
Creates a Draft API in APIConnect
This method pushes a swagger document containing the definition of an
API to APIConnect.
|
java.lang.String |
createDraftProduct(java.lang.String orgId,
java.lang.String productTitle,
java.lang.String productName,
java.lang.String productVersion,
java.util.ArrayList<APIConnectClient.APIInfo> apiIdList)
Creates a draft product containing the APIs supplied
This method creates a draft product using the supplied name and the
list of Draft APIs.
|
APIConnectClient.APIInfo |
createOrReplaceDraftAPI(java.lang.String orgId,
java.lang.String apiProtocol,
java.lang.String apiHost,
Api api)
Create or Replace a Draft API in APIConnect
This method is used to push an API to API connect.
|
int |
getAPIConnectVersion()
Retrieves the version of APIConnect connected.
|
int |
getTimeout()
Get the currently configured HTTP request timeout for all interactions
with IBM API Connect.
|
java.lang.String |
lookupCatalogId(java.lang.String orgId,
java.lang.String catalogName)
Retrieves the id for the named Catalog from APIConnect
This method queries APIConnect to retrieve the id for the named
catalog.
|
APIConnectClient.ProductSummary |
lookupDraftProduct(java.lang.String orgId,
java.lang.String productName,
java.lang.String productVersion)
Retrieves the product summary for a Draft product
This method queries APIConnect to retrieve summary information for
a draft product.
|
java.util.ArrayList<APIConnectClient.ProductSummary> |
lookupDraftProducts(java.lang.String orgId)
Retrieves the list of draft products
This method queries APIConnect to retrieve the list of draft products
which exist in the draft workspace.
|
java.util.ArrayList<APIConnectClient.ProductSummary> |
lookupStagedProducts(java.lang.String orgId,
java.lang.String catalogId)
Retrieves the list of products which have been staged
This method queries APIConnect to retrieve the list of products
which have been defined and staged in the specfied catalog.
|
APIConnectClient.APIInfo |
queryAPI(java.lang.String orgId,
java.lang.String apiTitle,
java.lang.String apiVersion)
Retrieves from APIConnect details about a Draft API
This method retrieves from APIConnect the details about the named
Draft API.
|
java.util.List<APIConnectClient.Catalog> |
queryCatalogIds(java.lang.String orgId)
Retrieves the list of Catalogs defined for the Organization
This method queries APIConnect to retrieve the list of Catalogs
defined for the organization.
|
java.lang.String |
queryCurrentUserInfo()
Retrieves configuration data for the current user from APIConnect
This method queries APIConnect to retrieve the configuration for the
current user.
|
java.util.List<APIConnectClient.Organization> |
queryOrganizationIds()
Retrieves from APIConnect the list of defined organisations.
|
APIConnectClient.APIInfo |
replaceDraftAPI(java.lang.String orgId,
APIConnectClient.APIInfo apiInfo,
java.lang.String apiProtocol,
java.lang.String apiHost,
Api api)
Replaces an existing Draft RestAPI in APIConnect
This method pushes a swagger document containing the definition of an
API to APIConnect in order to replace an existing Draft API.
|
APIConnectClient |
setTimeout(int timeout)
Set the HTTP request timeout for all interactions with IBM API Connect.
|
java.lang.String |
stageProductInCatalog(java.lang.String orgId,
java.lang.String productId,
java.lang.String catalogId)
Stages a Draft product in a Catalog
This method stages a product in the identified Catalog.
|
void |
stop()
This method is called to stop the httpClient associated with the
APIConnectClient.
|
java.lang.String |
updateDraftProduct(java.lang.String orgId,
java.lang.String productId,
java.util.ArrayList<APIConnectClient.APIInfo> apiIdList)
Updates the list of API's in a Draft Product
This method updates the product identified by it's id with the listed
API's.
|
public APIConnectClient(java.lang.String hostname, int port, java.lang.String userId, java.lang.String password) throws APIConnectClientException
hostname
- The hostname of the APIConnect serverport
- The port of the APIConnect serveruserId
- The userid to use to connect to APIConnectpassword
- The password to use to connect to APIConnectAPIConnectClientException
public APIConnectClient(java.lang.String hostname, int port, java.lang.String userId, java.lang.String password, java.util.Properties properties) throws APIConnectClientException
hostname
- The hostname of the APIConnect serverport
- The port of the APIConnect serveruserId
- The userid to use to connect to APIConnectpassword
- The password to use to connect to APIConnectproperties
- APIConnectClientException
public void stop()
public int getAPIConnectVersion() throws APIConnectClientException
APIConnectClientException
public java.util.List<APIConnectClient.Organization> queryOrganizationIds() throws APIConnectClientException
The URL used is: get //
APIConnectClientException
public APIConnectClient.APIInfo queryAPI(java.lang.String orgId, java.lang.String apiTitle, java.lang.String apiVersion) throws APIConnectClientException
The URL used for v4 is: get //
orgId
- The id of the organisation containing the APIapiTitle
- The name of the API to be queriedapiVersion
- The version of the API to be queriedAPIConnectClientException
public APIConnectClient.APIInfo createOrReplaceDraftAPI(java.lang.String orgId, java.lang.String apiProtocol, java.lang.String apiHost, Api api) throws APIConnectClientException
- Verify the API/version does not already exist in Sandbox - Query if the API/version exists as a draft - If draft exists then replace draft api - Else create draft api
orgId
- The organisation which owns the APIapiProtocol
- The protocol for the API (e.g. http or https)apiHost
- The hostname of the APIapi
- The API definitionAPIConnectClientException
public APIConnectClient.APIInfo createDraftAPI(java.lang.String orgId, java.lang.String apiProtocol, java.lang.String apiHost, Api api) throws APIConnectClientException
This method fails if the API already exists.
The URL used is: post //
orgId
- The organisation which owns the APIapiProtocol
- The protocol for the API (e.g. http or https)apiHost
- The hostname of the APIapi
- The API definitionAPIConnectClientException
public APIConnectClient.APIInfo replaceDraftAPI(java.lang.String orgId, APIConnectClient.APIInfo apiInfo, java.lang.String apiProtocol, java.lang.String apiHost, Api api) throws APIConnectClientException
The URL for v4 is: post //
orgId
- The organisation which owns the APIapiInfo
- Detaisl of the API being updatedapiProtocol
- The protocol for the API (e.g. http or https)apiHost
- The hostname of the APIapi
- The API definitionAPIConnectClientException
public java.lang.String queryCurrentUserInfo() throws APIConnectClientException
The URL used is: get //
APIConnectClientException
public java.lang.String lookupCatalogId(java.lang.String orgId, java.lang.String catalogName) throws APIConnectClientException
The REST API's used to query catalog information refer to catalogs as Envrionments but externally they are known as Catalogs.
The URL used is: get //
orgId
- The id of the organisationcatalogName
- The name of the catalog to be retrievedAPIConnectClientException
public java.util.List<APIConnectClient.Catalog> queryCatalogIds(java.lang.String orgId) throws APIConnectClientException
The REST API's used to query catalog information refer to Catalogs as Environments but externally they are known as Catalogs. A Sandbox catalog is identified using the "Sandbox" property not by name.
The URL used is: get //
orgId
- The id of the organisationAPIConnectClientException
public java.util.ArrayList<APIConnectClient.ProductSummary> lookupDraftProducts(java.lang.String orgId) throws APIConnectClientException
The URL used is: get //
orgId
- The id of the owning organisationAPIConnectClientException
public java.util.ArrayList<APIConnectClient.ProductSummary> lookupStagedProducts(java.lang.String orgId, java.lang.String catalogId) throws APIConnectClientException
The URL used is: get //
orgId
- The id of the owning organisationcatalogId
- The id of the catalog to be searchedAPIConnectClientException
public APIConnectClient.ProductSummary lookupDraftProduct(java.lang.String orgId, java.lang.String productName, java.lang.String productVersion) throws APIConnectClientException
The URL used is: get //
orgId
- The id of the owning organisationproductName
- The name of the productproductVersion
- The version of the productAPIConnectClientException
public java.lang.String createDraftProduct(java.lang.String orgId, java.lang.String productTitle, java.lang.String productName, java.lang.String productVersion, java.util.ArrayList<APIConnectClient.APIInfo> apiIdList) throws APIConnectClientException
The JSON product to create the product is based upon the following:
{ product: "1.0.0", info: { title:, name: , version: }, visibility: { view: { enabled: true, type: "public" }, subscribe: { enabled: true, type: "authenticated" } }, apis: { " ": {"id": " "} ... } plans: { default: { title: "Default", apis: [ " ", ... ] } } }
The URL used is: post //
orgId
- The id of the owning organisationproductTitle
- The title of the productproductName
- The name of the productproductVersion
- The version of the productapiIdList
- The list of Draft API's to be added to the productAPIConnectClientException
public java.lang.String updateDraftProduct(java.lang.String orgId, java.lang.String productId, java.util.ArrayList<APIConnectClient.APIInfo> apiIdList) throws APIConnectClientException
The URL used is: get //
orgId
- The id of the owning organisationproductId
- The id of the product to be updatedapiIdList
- The list of Draft API's to be added to the productAPIConnectClientException
public java.lang.String stageProductInCatalog(java.lang.String orgId, java.lang.String productId, java.lang.String catalogId) throws APIConnectClientException
The URL used is: post //
orgId
- The id of the owning organisationproductId
- The id of the product to be updatedcatalogId
- The id of the catalog in which to stage the productAPIConnectClientException
public int getTimeout()
public APIConnectClient setTimeout(int timeout)
timeout
- the HTTP request timeout.