Chapter 1: Projects
Create Project
Before importing an audio or video file, you need to have an existing project to import it into. If you don’t have a project yet, you can create one using the createProject
mutation
Create project
- This mutation creates a new project in your system. Once created, you can import files into it.
Example Graphql Mutation
mutation CreateProject($name: String!) {
createProject(name: $name) {
project {
slug
name
}
}
}
Example JS Code
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://your-graphql-endpoint.com/graphql",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.VUE_APP_API_KEY, // Make sure to set your API key
},
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("Your New Project Name");
- Replace “Your New Project Name” with the name you wish to assign to the new project.
Have questions?
Still have questions? Talk to support.