API process flow
Create Project
Before uploading an audio or video file, you must create or select an existing project.
If you don’t have a project yet, you can create one using the
createProject mutation.
Create project
- The
createProjectmutation creates a new project in your workspace. Once created, you can import audio/video files into it and begin generating protocols.
Example Graphql Mutation
mutation CreateProject($name: String!) {
createProject(name: $name) {
project {
slug
name
}
}
}
JavaScript Example (Axios)
import axios from "axios";
export const CREATE_PROJECT_MUTATION = `
mutation CreateProject($name: String!) {
createProject(name: $name) {
project {
slug
name
}
}
}
`;
const createProject = async (name) => {
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, // Ensure your API key is set
},
data: JSON.stringify({
query: CREATE_PROJECT_MUTATION,
variables: { name },
}),
});
console.log("Created Project:", response.data.data.createProject.project);
} catch (error) {
console.error("Error creating project:", error);
}
};
// Example usage:
createProject("My New Project");
Notes
- Replace “My New Project” with the name you want for your project.
- The returned values include the project’s slug and name, which you will need for later steps such as uploading files.
Have questions?
Still have questions? Talk to support.