Zum Hauptinhalt springen

GraphQl

Runs a GraphQL query or mutation against a tenant and prints the response JSON to standard output. Authenticates with a token for that tenant.

Examples​

Query a tenant; the response JSON is the only thing written to standard output:

octo-cli -c GraphQl -tid "meshtest" -q "{ runtime { systemTenants { totalCount } } }"

Output:

{"data":{"runtime":{"systemTenants":{"totalCount":3}}}}

Query from a file with variables:

octo-cli -c GraphQl `
-tid "meshtest" `
-f "query.graphql" `
-vars "{"first":10}"

Query from standard input, e.g. cat query.graphql | octo-cli -c GraphQl -tid meshtest -si:

octo-cli -c GraphQl -tid "meshtest" -si

Options​

ShortLongRequiredDescription
-tid--tenantIdnoId of the tenant to query. Default: the tenant of the context
-q--querynoThe GraphQL query or mutation text
-f--filenoFile with the GraphQL document
-si--stdinnoRead the GraphQL document from standard input (also the default when input is piped and no document is given)
-vars--variablesnoVariables as a JSON object, or '@<file>' to read the JSON object from a file
-on--operationNamenoName of the operation to run when the document holds several