How to Create a Project
To create a Project, you must use a createProject
mutation. As a bare minimum, you have to provide accountId
in
which you are creating your Project, a name
of your Project and primaryDomain
.
- Mutation
- Variables
- Response
- cURL
mutation CreateProject($input: CreateProjectInput!) {
createProject(input: $input) {
project {
...ProjectDetails
}
}
}
fragment ProjectDetails on Project {
id
name
primaryDomain
# ...other fields you want to retrieve
}
{
"input": {
"accountId": "TjAwN0FjY291bnQ3MTU",
"name": "www.lumar.io Project",
"primaryDomain": "https://www.lumar.io/"
}
}
{
"data": {
"createProject": {
"id": "TjAwN1Byb2plY3Q2MTMy",
"name": "www.lumar.io Project",
"primaryDomain": "https://www.lumar.io/"
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"mutation CreateProject($input: CreateProjectInput!) { createProject(input: $input) { project { ...ProjectDetails } } } fragment ProjectDetails on Project { id name primaryDomain # ...other fields you want to retrieve }","variables":{"input":{"accountId":"TjAwN0FjY291bnQ3MTU","name":"www.lumar.io Project","primaryDomain":"https://www.lumar.io/"}}}' https://api.lumar.io/graphql
Of course, you can pass any of the optional fields at the time of creation. Explore
CreateProjectInput
to see what fields are available.