Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

confluence rest api java client returns null value

Gurmeet Saran September 22, 2022

I followed this guide https://blog.developer.atlassian.com/generating-a-java-rest-client-for-confluence-cloud/ to create confluence rest api client. But when I try to access basic API call, it always returns null value. When I turned on the debugging, I see rest api is returning 200 with response payload but there is some issue with serializing the data to java object and it returns null. 

I have use swagger codegen version 3.0.35 for generating rest api client. 

 

Sample client code

public static void main(String[] args) throws JsonProcessingException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setDebugging(true);
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("<<USERNAME>>");
basicAuth.setPassword("<<PASSWORD>>");

SpaceApi apiInstance = new SpaceApi(defaultClient);
try {
Space spaceArray = apiInstance.getSpace("DE", Arrays.asList("description.plain,homepage"));
System.out.println(spaceArray);
} catch (ApiException e) {
e.printStackTrace();
}
}

 


Sep 22, 2022 10:57:51 PM org.glassfish.jersey.logging.LoggingInterceptor log
INFO: 1 * Client response received on thread main
1 < 200
1 < Cache-Control: no-cache, must-revalidate
1 < Connection: keep-alive
1 < Content-Type: application/json
1 < Date: Fri, 23 Sep 2022 05:57:52 GMT
1 < Expires: Thu, 01 Jan 1970 00:00:00 GMT
1 < Server: nginx
1 < Set-Cookie: JSESSIONID=1g2eg21g23g213g; Path=/; HttpOnly
1 < Strict-Transport-Security: max-age=63072000; includeSubdomain; preload
1 < Transfer-Encoding: chunked
1 < X-ASEN: SEN-12303996
1 < X-AUSERNAME: <<USERNAME>>
1 < X-Content-Type-Options: nosniff,nosniff
1 < X-Seraph-LoginReason: OK
{"id":12343445,"key":"DE","name":"Data....",............}

null

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events