How to Get Projects
When you don't know Project ID
If you don't know the ID of your project you can fetch a list of projects that you have access to through the accounts.
- Query
- Response
- cURL
query MyProjects {
me {
id
username
accounts(first: 1) {
totalCount
nodes {
id
name
projects(first: 2) {
totalCount
nodes {
id
name
}
}
}
}
}
}
{
"data": {
"me": {
"id": "TjAwNFVzZXI4NjE",
"username": "Your User Name",
"accounts": {
"totalCount": 1,
"nodes": [
{
"id": "TjAwN0FjY291bnQ3MTU",
"name": "Your Account Name",
"projects": {
"totalCount": 10,
"nodes": [
{
"id": "TjAwN1Byb2plY3Q2MTMy",
"name": "www.example.com Project"
},
{
"id": "TjAwN1Byb2plY3Q5OTA2",
"name": "www.example.co.uk Project"
}
]
}
}
]
}
}
}
}
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":"query MyProjects { me { id username accounts(first: 1) { totalCount nodes { id name projects(first: 2) { totalCount nodes { id name } } } } } }"}' https://api.lumar.io/graphql
When you know your Project ID
If project ID is known (for example from URL) you can fetch the project directly.
- Query
- Response
- cURL
query MyProjectById {
getProject(id: "TjAwN1Byb2plY3Q2MTMy") {
id
name
primaryDomain
}
}
{
"data": {
"getProject": {
"id": "TjAwN1Byb2plY3Q2MTMy",
"name": "www.example.com Project",
"primaryDomain": "https://www.example.com/"
}
}
}
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":"query MyProjectById { getProject(id: \"TjAwN1Byb2plY3Q2MTMy\") { id name primaryDomain } }"}' https://api.lumar.io/graphql