gvdm
gvdm

Reputation: 3166

Start an application via REST API in Cloudify

I need to start an application on my Cloudify 2.7 instance via this REST API

As you can see, I need some paramers for the request, such as applicationFileUploadKey, applicationOverridesUploadKey, cloudOverridesUploadKey and even the applicationName.

In the REST documentation I cannot find any REST API showing me these parameters. I thought I could find some API which could return me the list of installable apps with the corresponding parameters needed for the deployment, but I found nothing.

Do you know how can I get the deployment parameters of the uploaded apps via REST?

Thank you Giulio

Upvotes: 1

Views: 467

Answers (1)

Noa Kuperberg
Noa Kuperberg

Reputation: 398

Installing an application requires:

  1. Packing the application
  2. Uploading relevant files (and getting their upload keys)
  3. Calling the Rest API to install the application.

As a reference, you can see how these steps are implemented as part of the CLI install-application command in "doExecuteNewRestClient" here

Note: Each upload action returns a unique key (the upload key I mentioned), which is what you should use later when actually calling the Rest API to install the application.

The uploaded files only resides on the server for approx. 5 minutes, so the upload repo doesn't function as a repository, and the files are expected to be uploaded again the next time you install an application even if it's the same app.

Uploading the recipe is mandatory!

The following uploads are optional, they simply customize your deployment:

• cloud configuration – File or directory containing configuration information to be used by the cloud driver for this application (file size limited to 10K)

• overrides – File containing properties to be used to override the current properties of the application and its services (limited to 20K)

• cloud overrides – File containing properties to be used to override the current cloud configuration for this application and its services (10K)


To upload the files and get the keys follow these steps:

  1. Verify that file is not bigger than the maximum upload size limit. The limit for recipes is 100MB

  2. Post your packed application to your_management_server:8100/2.7.0/upload/your_packed_application.zip and add the file as a multipart entity to the request. You can see how it's done by the Rest client here in method "postFile".

  3. Check out the method "executeRequest" in the above class to see how to handle errors and read the response object

  4. Extract the upload key from the response

Then go ahead and call the Rest install application API with the keys you have.

Upvotes: 2

Related Questions