menu button

API process flow

Get All Projects

Projects & Protocols Overview

Similar to platforms like GitHub, our system uses the following structure:

  • User 1-n Project

  • Project n-m Protocol

A user must have at least one project before they can create a protocol.

There are two possible scenarios when starting:


Scenario 1: The user already has projects

  • You can retrieve all projects associated with the authenticated user using the getAllProjects query, with the example code provided below.

Example: Fetching all projects

import axios from "axios";

export const GET_ALL_PROJECTS = `
  query GetAllProjects {
    getAllProjects {
      slug
      name
    }
  }
`;

const getAllProjects = async () => {
  try {
    const response = await axios({
      method: "POST",
      url: "https://api-v2.speechmind.com/external/v2/graphql",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": process.env.VUE_APP_API_KEY,
      },
      data: JSON.stringify({
        query: GET_ALL_PROJECTS,
      }),
    });

    console.log("Projects:", response.data.data.getAllProjects);
  } catch (error) {
    console.error("Error fetching projects:", error);
  }
};

getAllProjects();

Scenario 2: The user has no projects yet

Have questions?

Still have questions? Talk to support.