Design: Retrieving project data best practice

Modified on Fri, 16 Jan at 12:35 PM

Information on projects (DesProject) is rich and deep and so it can be expensive to retrieve all the data for lots of projects. We would instead recommend retrieving projects in two stages: firstly getting basic data about your projects; and secondly getting details within a specific selected project.

Step 1: Get the list of projects within your workspace including basic data:

# Gets the specified workspace's projects.
query Projects($workspaceUrl: String!) {
  desProjects(workspaceUrl: $workspaceUrl, first: 1000) {
    nodes {
      ...MyProject
    }
  }
}

fragment MyProject on DesProject {
  id
  url
  name
  projectType
  description
  previewUrl
}

Step 2: Get more specific details about a selected project using that specific project identifier (id):

# Gets more details for the specified project.
query ProjectExtras($projectId: ID!) {
  desProjectById(id: $projectId) {
    latestRevision {
      ...MyProjectRevision
    }
    parameters {
      ...MyProjectParameter
    }
    projectPermissions {
      ...MyProjectPermission
    }
  }
}

fragment MyProjectRevision on DesVcsRevision {
  revisionId
  createdAt
  author
  message
}

fragment MyProjectParameter on DesProjectParameter {
  name
  value
}

fragment MyProjectPermission on DesProjectPermission {
  name
  scope
  canRead
  canEdit
  canCreate
  canDelete
  group {
    name
  }
  user {
    userName
  }
}



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article