Optional calls
Get Protocols by Project
Once a user selects a project, they can retrieve all the documents (called protocols) associated with that project using getProtocolsByProject query
Get protocols by project
- This operation returns a list of protocols for a specific project.
import axios from "axios";
export const GET_PROTOCOLS_BY_PROJECT = `
query GetProtocolsByProject($slug: String!) {
getProtocolsByProject(slug: $slug) {
slug
name
date
status
editStage
}
}
`;
const getProtocolsByProject = async (slug) => {
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_PROTOCOLS_BY_PROJECT,
variables: { slug },
}),
});
console.log('Protocols:', response.data.data.getProtocolsByProject);
} catch (error) {
console.error('Error fetching protocols:', error);
}
};
// Example usage
getProtocolsByProject("PROJECT_SLUG");
- Make sure to replace “PROJECT_SLUG” with the actual slug of the project you want to query.
After calling this query, the output will include all the protocols related to the specified project.
Have questions?
Still have questions? Talk to support.