Use the mqsipushapis command
to create or update the definition of one or more deployed REST APIs
on IBM® API Connect.
Before you begin
You must complete the following tasks:
- Register or update credentials for the API owner with IBM API Connect:
- If you intend to stage the REST API to a catalog, ensure that the IBM API Connect server has a catalog to which you can stage a product that
includes the REST API. If a current version of the REST API exists in the catalog, then staging a
new version of the REST API unpublishes the current version and changes it to staged state.
- Ensure that any firewalls allow the following connections:
- IBM App Connect Enterprise can connect to the IBM API Connect server by using HTTPS.
- The IBM API Connect server can
connect to the integration server by using HTTP or HTTPS.
- Create a REST API in the IBM App Connect
Enterprise Toolkit;
see Creating a REST API.
- Deploy the REST API to the integration server; see Packaging and deploying a REST API.
About this task
You can use the mqsipushapis command to push the
definition of one or more REST APIs to IBM API Connect. If the REST API
definition exists on the IBM API Connect system, you replace the REST
API definition with the new definition of your REST API.
Procedure
Follow these steps to push one or more deployed REST APIs to the IBM API Connect server:
- Optional: Construct the mqsipushapis command in the web user interface
by using the Push REST APIs to API Connect dialog and then clicking
Copy command to copy the output to the clipboard. For more information, see
step 1 to step 10 in Pushing REST APIs to IBM API Connect by using the web user interface. You can use the output
to modify the mqsipushapis command and then run it at step 2.
- Use the mqsipushapis command to
create or update the definition of your deployed REST APIs to an IBM API Connect server. Ensure that you have the correct parameters for the
version of IBM API Connect that you want to use.
- Version 5. The following example shows how you can use the command to push REST APIs to
IBM API Connect Version 5 and stage the product in the
catalog:
mqsipushapis INODE --integration-server default --apic-host mysystem
--apic-port 443 --apic-version v5 --apic-username testuser --apic-password mypassword
--apic-org myOrg –-apic-catalog-title MyCatalog --apic-product-title MyProduct
–-apic-product-name ProdName –-apic-product-version 2.0.0 --rest-apis myapi1:myapi2:myapi3
You
can choose to be prompted for the IBM API Connect password rather than
entering it in the command, by specifying --apic-password ""
(an empty string in
double quotes).
Version 2018. The following example shows how you can use the mqsipushapis command to push REST APIs to IBM API Connect Version 2018 and stage the product in the
catalog:
mqsipushapis --admin-host localhost --admin-port 4415 --apic-version v2018
--apic-host myhost --apic-port 443 --apic-org v2018-org --apic-product-title myProduct2
--apic-product-name my-product-2 --rest-apis myapi1 --apic-username v2018-user --apic-password ""
--apic-realm provider/default-idp-2 --apic-client-id clientid --apic-client-secret clientsecret
--apic-catalog-title Sandbox --integration-server CVS --apic-disable-certificate-verification
In
this example, an empty string is specified for the password parameter (--apic-password
""
), so the system prompts for the IBM API Connect
password.The command must also include parameters for the realm, client ID, and client secret.
Client ID and Client Secret: To obtain a Client ID and Client Secret, you
must register a client application with the
IBM API Connect environment
by using the
IBM API Connect command-line interface. The client
application in this case is
IBM App Connect Enterprise. Follow these steps to obtain a
Client ID and Client Secret:
- Create a JSON object with the following fields:
- name
- client_id
- client_secret
- client_type
Example JSON:ace-registration.json
{
"name": "ace-registration",
"client_id": "clientid",
"client_secret": "clientsecret",
"client_type": "toolkit"
}
- Download and install the CLI version of the IBM API Connect
command-line interface, as described at https://www.ibm.com/docs/en/api-connect/2018.x?topic=environment-installing-toolkit.
- Log in to the IBM API Connect command-line
interface.
./apic-slim login
- Create an IBM API Connect registration for IBM App Connect Enterprise by running the following command in the IBM API Connect command-line interface. Specify the JSON object that you
created as the input file.
./apic-slim registrations:create --server mycloudmanager.mydomain.com ace-registration.json
If
you specify an existing client_id in the JSON object, the registration process silently generates a
new client_id.
- Confirm the registration by running the following
command:
./apic-slim registrations:get --server mycloudmanager.mydomain.com ace-reg
Version 10. The following example shows how you can use
the mqsipushapis command to push REST APIs to IBM API Connect Version 10 and stage the product in the
catalog:
mqsipushapis --admin-host localhost --admin-port 4415 --apic-version v10
--apic-host myhost --apic-port 443 --apic-org v10-org --apic-product-title myProduct2
--apic-product-name my-product-2 --rest-apis myapi1 --apic-username v10-user --apic-password ""
--apic-realm provider/default-idp-2 --apic-client-id clientid --apic-client-secret clientsecret
--apic-catalog-title Sandbox --integration-server CVS --apic-disable-certificate-verification
In
this example, an empty string is specified for the password parameter (--apic-password
""
), so the system prompts for the IBM API Connect
password.The command must also include parameters for the realm, client ID, and client secret.
Client ID and Client Secret: To obtain a Client ID and Client Secret, you
must register a client application with the
IBM API Connect environment
by using the
IBM API Connect command-line interface. The client
application in this case is
IBM App Connect Enterprise. Follow these steps to obtain a
Client ID and Client Secret:
- Create a JSON object with the following fields:
- name
- client_id
- client_secret
- client_type
Example JSON:ace-registration.json
{
"name": "ace-registration",
"client_id": "clientid",
"client_secret": "clientsecret",
"client_type": "toolkit"
}
- Download and install the CLI version of the IBM API Connect
command-line interface, as described at https://www.ibm.com/docs/en/api-connect/10.0.x?topic=configuration-installing-toolkit.
- Log in to the IBM API Connect command-line
interface.
./apic-slim login
- Create an IBM API Connect registration for IBM App Connect Enterprise by running the following command in the IBM API Connect command-line interface. Specify the JSON object that you
created as the input file.
./apic-slim registrations:create --server mycloudmanager.mydomain.com ace-registration.json
If
you specify an existing client_id in the JSON object, the registration process silently generates a
new client_id.
- Confirm the registration by running the following
command:
./apic-slim registrations:get --server mycloudmanager.mydomain.com ace-reg
For more information about creating the JSON object and client registration, see https://apic-api.apiconnect.ibmcloud.com/v10/#/documentation/authentication/auth_clientid_secret.
Note: If the IBM API Connect environment is configured with self-signed
certificates or if the certificate configuration does not match the domain of the IBM API Connect environment, the command fails. Include the parameter
--apic-disable-certificate-verification to instruct IBM App Connect Enterprise to ignore the errors.
- When the command is run, the selected REST APIs are pushed to the IBM API Connect server:
- If there is an existing API definition on the IBM API Connect
server, the existing definition is replaced by the definition of your REST API. If there is no
existing API definition on the server, a new API definition is created for your REST API.
- If the specified product exists, it is updated. If the specified product does not exist, a new
product is created.
- If a catalog is selected, the product is staged in the catalog.
Results
Your REST API definition is created or updated on an IBM API Connect server.