Before you begin

You need to do the following actions before you use Synthetic APIs.

  1. Before you run Synthetic API commands, retrieve the authentication token (ACCESS_TOKEN). To obtain the access token, see Preparing to run component or management API commands.

  2. Get the Synthetic route host name by running the command oc get route -n management-monitoring in cp4mcm hub cluster. The Synthetic Route Port is 443 by default. In the following example, the Synthetic route host is monitoring-synthetic-management-monitoring.apps.pogey.cp.fyre.ibm.com.

     [root@pogey-inf ~]# oc get route -n management-monitoring
     NAME                   HOST/PORT                                                               PATH   SERVICES               PORT             TERMINATION   WILDCARD
     monitoring-synthetic   monitoring-synthetic-management-monitoring.apps.pogey.cp.fyre.ibm.com          monitoring-synthetic   client-connect   edge          None
     monitoring-threshold   monitoring-threshold-management-monitoring.apps.pogey.cp.fyre.ibm.com
    
  3. If you have multiple console accounts, and don't want to call Synthetic APIs with the default account, you need to pass the X-TenantID parameter to the HTTP header. For example, run the following command to pass f206-de37 as the X-TenantID.

     curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -H 'X-TenantID: f206-de37' -i 'http://<synthetic_route_address>/synthetic/1.0/synthetic_tests'
    

    Note: To get the X-TenantID for your account, click the User icon on IBM Cloud Pak console. The X-TenantID for the default account is id-mycluster-account.