Latest Poppulo platform GraphQL API
Cost analysis is the process of analysing the complexity of query fields and setting a cost value on each one. Each query will have a complexity limit. This limit will restrict retrieval of all available fields in one query.
Graphql allows for deeply nested or expensive queries. A limit is necessary to prevent a denial-of-service attack. This kind of attack can be caused by a malicious actor or by an unintentionally large query. The query complexity limit, and the individual field costs will be viewable in time within the Graphql API Reference section.
This is an example of a circular dependency between the continent and countries types.
{
continents {
countries {
continent {
countries {
continent {
countries {
name
}
}
}
}
}
}
}
The complexity limit restricts unnecessarily large queries like this one.
Status Code: 422 Unprocessable Entity
Error message: Query is too complex: $QueryCost. Maximum allowed complexity: $QueryLimit