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
| Short | Long | Required | Description |
|---|---|---|---|
-tid | --tenantId | no | Id of the tenant to query. Default: the tenant of the context |
-q | --query | no | The GraphQL query or mutation text |
-f | --file | no | File with the GraphQL document |
-si | --stdin | no | Read the GraphQL document from standard input (also the default when input is piped and no document is given) |
-vars | --variables | no | Variables as a JSON object, or '@<file>' to read the JSON object from a file |
-on | --operationName | no | Name of the operation to run when the document holds several |