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 "Organisation de l'Etat et des services publics", finds the first 2 contributors, and returns many types of steps with their related data including questionnaire, questions or proposals:

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