Is it possible to fetch all projects?

I am interested in creating an application that allows a user to browse projects I have uploaded, then choose one to examine in the viewer. Is it possible to fetch (either via GraphQL or the REST API) all of my projects?

In the GraphQL Explorer, I have tried the following:

{
  project {
    id
    name
  } 
}

But get the following response, which suggests to me I can only fetch projects one at a time, and only if I know the ID’s:

{
  "errors": [
    {
      "message": "Field \"project\" argument \"id\" of type \"String!\" is required, but it was not provided.",
      "locations": [
        {
          "line": 32,
          "column": 3
        }
      ],
      "extensions": {
        "code": "GRAPHQL_VALIDATION_FAILED"
      }
    }
  ]
}

Is my conclusion correct that it is not possible to fetch the ID and name of all of my projects at once?

Hey @Glenn you might want something like this:

query User {
    user {
        projects(limit: 20) {
            totalCount
            cursor
            items {
                id
                name
                description
                visibility
                allowPublicComments
                role
                createdAt
                updatedAt
                sourceApps
            }
        }
    }
}

This will fetch 20 of your projects if you make the request as yourself/token. If you want to display more projects or loop through them you can use cursor.

Hope this helps.

1 Like