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 "Après l’échec d’Hadopi, le gouvernement abat une nouvelle carte pour protéger les œuvres culturelles sur internet", finds the first 2 contributors, and returns many types of steps with their related data including questionnaire, questions or proposals:

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