cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get relations using automation REST api

Chris_
Champ in-the-making
Champ in-the-making

Hi,

I'm using Nuxeo 5.6. I try to use REST api to get related documents. I use operation Relations.GetRelations with parameters: predicate = References outgoing = true and input: doc:344fad4a-99bf-45b2-85fc-63c45e48093d.

Operation returns empty list of documents although document with this uid has outgoing reference with predicate References. I tried some other operations and they worked so I know how to create correct request. Did someone have similar issue? Does operation Relations.GetRelations work correctly? There is also one additional parameter graphName, what is it's purpose?

Thanks for help.

2 REPLIES 2

Artmoni_Mobile
Champ on-the-rise
Champ on-the-rise

Hi,

did you find an answer? I encounter a similar issue.

Thanks

russtrotter_
Confirmed Champ
Confirmed Champ

I know this answer is a year late, but I just learned how to do this in 5.8 LTS. The trick is to understand what valid "predicate" values are, e.g. I had to use a DOM inspector on the DM UI to realize that they are actually URIs, here are valid values:

So, to query the relations of a document with the API, do the following:

  • request method POST
  • URL path /nuxeo/api/v1/automation/Relations.GetRelations
  • request header "Accept: application/json+nxentity,/"
  • request header "Content-Type: application/json+nxrequest"

Your request body should be like this:

{
 "input":"/default-domain/workspaces/mydoc",
 "context":{},
 "params":{
    "predicate":"http://purl.org/dc/terms/References",
    "outgoing":false
  }
}

Notes:

  • input JSON parameter identifies the relations for
  • params.predicate is one of the URIs from above
  • params.outgoing: true=return outgoing relations from this document, false=return incoming relations to this document

hope that helps!

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.