Extra field value in the response

cancel
Showing results for 
Search instead for 
Did you mean: 
om_bijawat
Member II

Extra field value in the response

Jump to solution

We are using feign client api's in our implementation to fetch the data from Alfresco.
Below dependency of alfresco is used n pom to fetch the data

<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-java-rest-api-spring-boot-starter</artifactId>
<version>5.0.4</version>
</dependency>

In many if the API methods there is one parameter which is a List of String, in which we can define the extra parameters whose values is required in the response which we receive.
For Eg: path, permissions, aspectNames etc.
In one of our case we were trying to fetch multiple values like path and permissions both, but we are getting only one which we add first in the list.
For Eg: If you see the below code snippet in which we included permissions and path both. Please find the code snipper below.

public final NodeEntry getNode(String nodeId) {
NodesApiClient nodesApi = Feign.builder().contract(new SpringMvcContract()).decoder(feignDecoder())
.requestInterceptor(getBasicAuth()).target(NodesApiClient.class, url);
NodeEntry node;
List include = new ArrayList();
include.add("permissions");
include.add("path");
node = nodesApi.getNode(nodeId, include, null, null).getBody();
return node;
}

When we run the above code, in the result we are getting permissions only and not the path and this we have observed in almost with all the api methods.
Note: When we hit the same api as a swagger in the browser then we get the expected results.

Are we doing something wrong here?

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: Extra field value in the response

Jump to solution

I reproduced your problem with the exact versions you are using.

The problem has been detailed in following ticket:

https://github.com/Alfresco/alfresco-java-sdk/issues/97

While this is being solved, you can apply this workaround:

String nodeId = "8bb36efb-c26d-4d2b-9199-ab6922f53c28";
List<String> include = List.of("permissions,path");

Node node = nodesApi.getNode(nodeId, include, null, null).getBody().getEntry();

LOG.info("Permissions: " + node.getPermissions());
LOG.info("Path: " + node.getPath());
Hyland Developer Evangelist

View solution in original post

3 Replies
angelborroy
Alfresco Employee

Re: Extra field value in the response

Jump to solution

I've made a basic tests using Alfresco REST Client SDK, sample available in

https://github.com/aborroy/alfresco-rest-client

Following code allows me to get "path" and "permissions" in the results:

List<String> include = new ArrayList<>();
include.add("permissions");
include.add("path");

nodesApi.getNode("2ba6f3b7-fd7c-48b6-8f6e-dd6c250db89b", include, null, null);
Hyland Developer Evangelist
om_bijawat
Member II

Re: Extra field value in the response

Jump to solution

Very strange,

Don't know why its not working for me.

Is working on community version can be the issue for this?

Are you working on community version or enterprise version of ACS.

Thanks

angelborroy
Alfresco Employee

Re: Extra field value in the response

Jump to solution

I reproduced your problem with the exact versions you are using.

The problem has been detailed in following ticket:

https://github.com/Alfresco/alfresco-java-sdk/issues/97

While this is being solved, you can apply this workaround:

String nodeId = "8bb36efb-c26d-4d2b-9199-ab6922f53c28";
List<String> include = List.of("permissions,path");

Node node = nodesApi.getNode(nodeId, include, null, null).getBody().getEntry();

LOG.info("Permissions: " + node.getPermissions());
LOG.info("Path: " + node.getPath());
Hyland Developer Evangelist