Accessing the Q Replication REST API for Db2
You can access the Q Replication API through an interactive user console or by using cURL commands on a system with network connectivity to the Q Replication REST API server.
Before you begin
- The hostname of the cluster that contains the database that you want to replicate.
- The external port number of the Q Replication REST API server.
You can find the REST external port number by running the following command:
oc get svc -n <db2_instance_namespace>| grep <db2_instance_id> | grep 9444 | sed 's/.*9444://' | sed 's/\/TCP.*//')
About this task
The Q Replication REST API provides you with several tools organized into five categories to develop your own Q Replication-enabled applications:
- Health
- Monitor the health of the Q Replication environment.
- Replication set
-
- Create, update, delete, list, start, stop, add, or remove a table.
- Start or stop replication for tables or list of tables.
- Add schema-level subscriptions to a set, remove them from a set, and start or stop schema-level subscriptions.
- Monitor a replication set and get historical metric data.
- Source
- Enable Q Replication, activate Q Replication, check for requirements, check for a Transport Layer Security (TLS) certificate, validate connectivity, update credentials, and monitor API calls on the source database.
- Target
- Initialize Q Replication, check requirements, validate connectivity, trust and exchange certificates, update credentials, and monitor API calls on the target database.
- Tools and utilities
- Check the status of nonconcurrent API calls.
Note: You can use a cURL command to make Q Replication API calls on a system with network
connectivity to the Q Replication API server.
cURL is a free command-line tool that can call the Q Replication REST API on any system that has connectivity to the Q Replication REST API server. The cURL command uses the libcURL client-side URL transfer library, which supports many different transfer protocols, including HTTPS, SMTP, and FTP. Q Replication REST APIs support HTTPS.
- cURL command
- A cURL command is an API request that you can copy into a command shell or script. If you want
to run the cURL command outside of the API console, specify the following options:
- The Insecure option (
-k
or--insecure
), if you do not have a CA-signed certificate that is installed in your environment. - The header (
-H
or--header
) to specify input and output data format, including API server authentication. - User authentication (-u or --user), or authorization header (--header 'Authorization: Basic your_basic_token') where your basic token can be generated by using the following:
-
echo <source_db_username>:<source_db_password> | base64
- Data (
-d
or--data
) sends specified data in a POST request with a body parameter to the Q Replication REST API server. - A URL
--url
to a Q Replication REST API endpoint.
curl -- help
command. - The Insecure option (
- Request URL
- The URL that is used when a web client makes a request to a server for a resource.
- Response Body
- The Java code that is returned from the API call and that you can incorporate into your applications.
- Response Code
- The response code that is returned from the API call.
- Response Headers
- An HTTP header that can be used in an HTTP response and that does not relate to the content of the message.