Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sysread/bash-gql
A command line GraphQL client written in bash
https://github.com/sysread/bash-gql
Last synced: about 2 months ago
JSON representation
A command line GraphQL client written in bash
- Host: GitHub
- URL: https://github.com/sysread/bash-gql
- Owner: sysread
- License: mit
- Created: 2024-07-24T20:06:58.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-24T20:58:18.000Z (6 months ago)
- Last Synced: 2024-07-24T23:29:05.129Z (6 months ago)
- Language: Shell
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
A command line tool for working with GraphQL APIs
# DESCRIPTION
`gql` is a command line tool for working with GraphQL APIs. Like Insomnia or
Postman, it allows you to send queries and mutations to a GraphQL API and see
the results, as well as to introspect the schema.# REQUIREMENTS
- [`curl`](https://github.com/curl/curl)
- [`jq`](https://github.com/jqlang/jq)# OPTIONAL
- [`gum`](https://github.com/charmbracelet/gum)
# INSTALL
Currently, this tool is just a single script that you can download and run.
Either clone the repo or save it directly.# USAGE
```
gql --helpgql --host myservice.com/gql --schema
# Oops, forgot to log in first! :D
gql --host myservice.com/gql --query login.gql --input '{"input": {"user": "someone", "password": "fnord"}}' | jq -r '.data.login.token' | tee /tmp/token
gql --host myservice.com/gql --bearer "$(cat /tmp/token)" --schemagql --host myservice.com/gql --refresh-schema
gql --host myservice.com/gql --mutations
gql --host myservice.com/gql --queries
gql --host myservice.com/gql --typesgql --host myservice.com/gql --query-docs getSomeEntity
gql --host myservice.com/gql --mutation-docs createSomeEntity
gql --host myservice.com/gql --type-docs SomeEntity
```# AUTHENTICATION
Currently, `gql` only supports bearer tokens for authentication.
```sh
$ gql --host myservice.com/gql \
--query login.gql \
--input '{"input": {"user": "someone", "password": "fnord"}}' \
| jq -r '.data.login.token' \
| tee /tmp/token$ gql --host myservice.com/gql \
--bearer "$(cat /tmp/token)" \
--query getSomeEntity.gql
--input '{"input": {"entityId": "fnord-but-as-an-id"}}'
```