API and subprojects

Issue #260 resolved
Jens Doose created an issue

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)

  1. Robert Reiz

    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.

    Screen Shot 2016-08-24 at 10.22.52.png

  2. Jens Doose 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?

  3. Robert Reiz

    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 :)

  4. Jens Doose 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"

  5. Robert Reiz

    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.

    Screen Shot 2016-10-03 at 10.48.15.png

    Let me know if you need more.

  6. Jens Doose 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!

  7. Log in to comment