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 "Consultation sur la culture", finds the first 2 contributors, and returns many types of steps with their related data including questionnaire, questions or proposals:

{
  node(id: "UHJvamVjdDo4Y2E2MGVkYi04MjE2LTExZTktODJhZS0wMjQyYWMxMTAwMDU=") {
    ... 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
              }
            }
          }
        }
      }
    }
  }
}