Cap Collectif Developers - GraphQL API

Look up projects

The following query looks up the last 5 published projects, and returns their id and title:

{
  projects(first: 5, orderBy: {field: PUBLISHED_AT, direction: DESC}) {
    totalCount
    edges {
      node {
        id
        title
        publishedAt
      }
    }
  }
}

Interactive section

The following query looks up the "Commerçants et producteurs alimentaires de proximité et en livraison", finds the first 2 contributors, and returns many types of steps with their related data including questionnaire, questions or proposals:

{
  node(id: "UHJvamVjdDozOGE5YjBjNy03MDEzLTExZWEtYmM1Mi0wMjQyYWMxMTAwMDQ=") {
    ... on Project {
      id
      title
      contributors(first: 2) {
        edges {
          node {
            username
          }
        }
      }
      steps {
        ... on ConsultationStep {
          id
          title
          timeRange {
            startAt
            endAt
          }
          url
          state
        }
        ... on QuestionnaireStep {
          id
          title
          questionnaire {
            id
            title
            questions {
              id
              title
              responses(first: 5) {
                edges {
                  node {
                    id
                  }
                }
              }
            }
          }
        }
        ... on CollectStep {
          id
          title
          proposals(first: 3) {
            totalCount
            edges {
              node {
                id
                title
              }
            }
          }
        }
      }
    }
  }
}