API and subprojects
Hi,
I would like to build a tool which automatically traverses a tree of directories which several sub-projects in it and create all the projects in VersionEye if they do not exist yet. To do so I have to be able to get a list of currently existing projects to find potential matches.
If the API is queried for projects only top-level projects are returned. In the documentation is command mentioned to query the projects for their sub projects. Is there any way to do so?
Thanks!
Comments (11)
-
-
reporter Great to hear!
-
- changed status to resolved
Done. Now if you fetch detail information about a project through the VersionEye API, the response includes the parent ID and the child IDs. See here.
-
reporter Hm, I don't see the new properties child_ids.
I have several projects merged into another project. My understanding is that the project I merge the others into becomes the "parent project", the other ones are named "the sub-projects". Is that right?
If I retrieve a list of all my projects with https://<baseurl>/api/v2/projects?api_key=<apikey> only the projects I merged other projects into are given. None of the projects has the property child_ids.
What am I doing wrong?
-
reporter - changed status to open
-
reporter Oh. I see. You changed the API to retrieve a SINGLE project. Was that intended?
-
- changed status to resolved
Hi @jdoose Sorry for the late response. I was busy in the last days. Yes, the projects API returns either a list of all parent projects or a SINGLE project with the given ID. If you retrieve a single project by it's ID than you will see at the bottom of the JSON object the
child_ids
. I just double checked it for my own projects and it works. If it still doesn't work for you I will debug it further with your account :) -
Here is an example request.
And please use the API Key from your organisation.
-
reporter Is there a reason to include the children ids only with the request for a single project?
And/Or would it hurt to add an additional, optional parameter in the request to get all projects including child projects? With the ids and the property "child_ids" a client could build a project "tree"
-
Hi @jdoose. Not a big deal :) I just updated the API again. Now in the project index view you still get only the parent projects, but now the JSON objects include the children IDs and parent IDs. I guess that will save you some API requests.
Let me know if you need more.
-
reporter That is great, thanks! I think maybe it would still be cool to get a list of all projects at once, saving some round trips. But I will try with this first and let you know!
Thanks!
- Log in to comment
OK. I will expose those projects as well ;-)