Search code examples
restibm-cloudcloud-foundrynode-red

Contacting Specific Cloud Controller API


The root of my problem is restarting a cloud_controller app with a REST call.

I'm trying to avoid making calls to pull all the necessary details from the instance, destroying it and recreating it, since I'm trying to restart a NodeRED instance that has a new flow in the cloudant db it's building itself from.

To handle this, I'm working to call a cloud controller V3 POST /v3/apps/:guid/actions/restart

Specifically, I'm looking to contact cloud_controller version: 3.63.0 instead of version: 2.128.0:

When I run cf curl / , it shows there are two cloud_controller APIs in the container I'm using:

C:\Users\RHQUB82>cf curl /
{
   "links": {
      "self": {
         "href": "https://api.us-south.cf.cloud.ibm.com"
      },
      "cloud_controller_v2": {
         "href": "https://api.us-south.cf.cloud.ibm.com/v2",
         "meta": {
            "version": "2.128.0"
         }
      },
      "cloud_controller_v3": {
         "href": "https://api.us-south.cf.cloud.ibm.com/v3",
         "meta": {
            "version": "3.63.0"
         }
      }, ...

I've tried to ask the IBM support desk to help me make REST calls specifically to the version 3.63.0 cloud_controller API, and the application UI seems able to contact it with a Restart button, but there doesn't seem to be a way to successfully get in contact with them, and I'm not certain how comfortable they are revealing the inner workings of Bluemix.

I've confirmed the POST request I'm planning to make is in version:3.63.0.


Solution

  • There's nothing specific to IBM environment here. It's just v3 of the Cloud Controller API, which is documented here.

    http://v3-apidocs.cloudfoundry.org/version/3.63.0/

    According to the information you posted, you would need to send requests to https://api.us-south.cf.cloud.ibm.com/v3. If you're using cf curl, it will do this automatically. You would just need to cf curl /v3/... and it'll do the rest.

    To your question regarding restarts, that's documented here.

    http://v3-apidocs.cloudfoundry.org/version/3.63.0/#app-restart

    As it's documented, you could do something like this:

    curl "https://api.us-south.cf.cloud.ibm.com/v3/apps/[guid]/actions/restart" \
    -X POST \
    -H "Authorization: bearer [token]"
    

    Hope that helps!