Developer Notes
Various notes on Developer Experience (DX) and performance of Spire API
#
Use GZIP CompressionSpire production GraphQL API api.spire.com/graphql supports GZIP compression of the output. Since JSON payload is mostly text, it compresses exceptionally well with GZIP. You can gain up to 20% reduction in payload size using GZIP compression in production.
We encourage our clients to send the header alongside with requests:
For example:
#
Query What you NeedUnlike REST where the endpoint defines the resource and the received data, the GraphQL exposes a single endpoint with a global schema where you can query whatever you want. The ability to define precisely the data you want — and only the data you want — is a powerful advantage over traditional REST API endpoints.
By making focused queries you can focus on data you need and omit unimportant one. If you need just vessel positions, then query for vessel positions and omit everything else. If you need vessel characteristics, then query for vessel positions and omit everything else.
The following example shows the query focused only on getting only positional information about the vessels:
Querying only what you need together with GZIP compression could significantly reduce the amount of transferred data and therefore increase the performance.
#
Schema as live DocumentationThe api.spire.com/graphql provides a GraphQL playground where you could create and execute a query of any complexity. This is perfect environment where you can prepare you query for production usage. The Docs button in the right top corner provides detailed information about GraphQL schema including query structure, fields and comments.
#
Request IdsEach response from GraphQL payload contains an extensions
object which has a requestId
field:
In case of any troubles or unclear errors, provide the requestId
to our support team. We use the requestId
to track down the cause of the issue you're dealing with in a faster and more efficient manner.