Content-Type: application/json
in the headers and a body like this:
query
and operationName
keys are required. The operationName
tells GraphQL which action should be executed. This can be helpful if you stack multiple queries and mutations in the query
key and want to execute them selectively (see the example at the bottom of the page).
The response will always come back in this form:
id
field of all client records accessible to the requesting user.
The query can be modified to return additional data, like the codename
and note
fields:
\n
.id
and title
of every finding in the database to get all our data back in a single request:
title
contains SMB
. This can be accomplished with nested database relationships and the addition of a condition:
severity
relationship, instead of returning the findings severityId
field. The severityId
is just the foreign key, an integer. The query uses the relationship to return the string value set to represent that severity (e.g., High).JSON.stringify()
or Python’s json.dumps()
to create the properly formatted payload for the POST request. However, this can lead to accidental double-encoding which will cause issues down the line. The simplest option is using a library built for handling GraphQL requests, like gql
for Python.
Here is an example query request in Python using the gql
library. For more examples and ideas, see this section: