List units
Reconstructed — official use case.
- GraphQL
- Node.js
- curl
query ListUnits($page: Int, $pageSize: Int) {
unitsV2(filters: [], page: $page, pageSize: $pageSize) {
data {
id
name
customReference
externalId
state
createdDate
}
meta {
totalCount
currentPage
hasNextPage
}
}
}
const { unitsV2 } = await ublo(
`query ($page: Int, $pageSize: Int) {
unitsV2(filters: [], page: $page, pageSize: $pageSize) {
data { id name customReference state }
meta { totalCount hasNextPage }
}
}`,
{ page: 1, pageSize: 50 },
);
- Bearer
- Cookie session
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H "Authorization: Bearer $UBLO_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"query":"query { unitsV2(filters: []) { data { id name customReference state } meta { totalCount } } }"}'
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H 'Content-Type: application/json' \
-b cookies.txt \
-d '{"query":"query { unitsV2(filters: []) { data { id name customReference state } meta { totalCount } } }"}'
note
state is computed: there is no direct API filter today — filter client-side if needed.