Content
You are here:
Project hierarchy from API
Added by Carlos Lacasta almost 7 years ago
I have projects with sub-projects and I do not see in the API v3 documentation an easy way to get the project hierarchy. I tried with the ancestor query but gives me an internal error
curl -g -u apikey:XXXX https://the_server/api/v3/projects?filters=[{ancestor
gives
{_type internal error has occured.“}{”_type“:”Error“,”errorIdentifier“:”urn:openproject-org:api:v3:errors:InternalServerError“,”message“:”An internal error has occured."}
Am I doing something wrong ?
Replies (4)
Hi Carlos,
try
1) the filters where missing a second closing curly brace (})
2) the filters value needs to be a dumped json object, which basically means having quotation marks around the value
Regards
Jens
thanks Jens !!
I am still getting the same error, which makes me think it has to do with your point 2). I thought the value is the project ID who is the ancestor of the subproject I want to get (it is at least what I understood from the example in the API doc.). Shouldn’t I get from the above the list of projects under project with id=19 ?
Cheers,
Carlos
Yes, once the request is correct, you will get the list of projects that are descendantes of the project provided as a filter value.
I assume that you do still have a typo in your curl command as what I posted even works agains e.g. community.openproject.com.
Can you please post your current command again so I can double check?
My fault… Sorry. Now it works.
Many thanks !
Carlos