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

4

1 回答 1

1

从 2.7 开始,服务控制器(您在此处指代)已被弃用,实际上仍可用于向后兼容。关于返回的 json 结构,文档确实是错误的。我的建议是使用更新的 API
/{version}/deployments/applications/description

如此所述,此 API 实际上返回一个包含 ApplicationDescription 对象列表的 json,因此在部署应用程序时,响应结构基本保持不变,但包含的列表会增长。

于 2014-05-04T12:09:41.613 回答