1

I have a Cloudify 2.7.0 instance running. I need to access Cloudify's API from a Java application and I found an incongruity between the returned JSON and the one which is documented in the Cloudify documentation. The API is

/service/applications

In the documentation I can read that it should return the following JSON string

{
  "status" : "success",
  "response" : [ "petclinic", "travel" ]
}

But if I do the same request to my Cloudify instance I get the following JSON string

{
  "status" : "success",
  "response" : {
        "petclinic": "",
        "travel":""
  }
}

In the java application the JSON information is stored in the following POJO (generated with JSONSchema2POJO)

// CloudifyResponse.java
public class CloudifyResponse {
   @JsonProperty("response")
   private Response response;
   @JsonProperty("status")
   private String status;
   // getters and setters
}

// Response.java
public class Response {
   @JsonProperty("helloworld")
   private String helloworld;
   @JsonProperty("petclinic")
   private String petclinic;
   // getters and setters
}

I use the Jackson library to deserialize JSON into POJO. As you can see the JSON string is deserialized into a POJO in which every istantiated application is a POJO's field. This might be a big problem for the development of the application. In fact, as the instances of the application change, the returned JSON changes and we need to update the POJO structure, something I can't do at runtime.

Do you know whether the Cloudify API has changed the response JSON structure? Is there any way to get the documented JSON output instead of the one I get.

Thank you in advance

Giulio

gvdm
  • 3,006
  • 5
  • 35
  • 73

1 Answers1

1

As of 2.7 The service controller (which you are referring to here) is deprecated, and actually remains available for backward compatibility. The documentation is indeed wrong regarding the returned json structure. My advice is to use the updated API
/{version}/deployments/applications/description

As documented here, this API actually returns a json holding a list of ApplicationDescription objects, so as application are deployed the response structure remains essentially the same, but the contained list grows.

Noa Kuperberg
  • 398
  • 2
  • 6