menu button

Optional calls

Get Protocols by Project

Get Protocols by Project

Use the getProtocolsByProject query to retrieve all protocols (documents) associated with a specific project.


Input Parameters

  • slug (String!) — the slug of the project to query. Get this from getAllProjects.

GraphQL Query

query GetProtocolsByProject($slug: String!) {
  getProtocolsByProject(slug: $slug) {
    slug
    name
    date
    status
    editStage
  }
}

Query Variables

{
  "slug": "PROJECT_SLUG"
}

Example JavaScript Implementation

import axios from "axios";

const GET_PROTOCOLS_BY_PROJECT = `
  query GetProtocolsByProject($slug: String!) {
    getProtocolsByProject(slug: $slug) {
      slug
      name
      date
      status
      editStage
    }
  }
`;

const getProtocolsByProject = async (slug) => {
  const res = await axios({
    method: "POST",
    url: "https://api-v2.speechmind.com/external/v2/graphql",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": process.env.SPEECHMIND_API_KEY,
    },
    data: JSON.stringify({
      query: GET_PROTOCOLS_BY_PROJECT,
      variables: { slug },
    }),
  });

  console.log("Protocols:", res.data.data.getProtocolsByProject);
};

Notes

  • Returns all protocols for the given project, including their status and editStage.
  • Replace PROJECT_SLUG with the actual project slug from getAllProjects.

Have questions?

Still have questions? Talk to support.