Skip to content

Instantly share code, notes, and snippets.

@twof
Last active September 10, 2023 06:44
Show Gist options
  • Save twof/29cec64aada9cc4e24cc329461a6fb3a to your computer and use it in GitHub Desktop.
Save twof/29cec64aada9cc4e24cc329461a6fb3a to your computer and use it in GitHub Desktop.

Curl GraphQL

Search used: curl "\"query\": \"{" OR "\"query\": \"query" language:Shell

Results: 342

Learnings

There are a few common use cases you'll see in the examples that do no parsing

  • Smoke testing an endpoint
  • Providing an example of how to hit an endpoint
  • What are effectively aliases to queries
  • Doing introspection to construct a schema

There were much broader use cases for the ones that do parsing. Folks can pick through these again, but of what I saw, if the script was doing any error checking, it was either bailing out if there was anything in the errors array, or bailing out if one of the fields the script was looking for was missing. I don't believe I saw any scripts that were attempting to deal with partial results.

Most queries were very simple, retrieving only a few fields.

No parsing:

  1. https://github.com/nilshartmann/spring-petclinic-graphql-heise/blob/71f7b272441a7607f02b7e00578ee894b3bfe049/talk/curl-demo.sh#L4
  2. https://github.com/picodotdev/blog-ejemplos/blob/4e1131b8b77a9dd845dea27e8896057155aef7ff/GraphQL/graphql-curls.sh#L9
  3. https://github.com/CrystallizeAPI/code-snippets/blob/533451598a155591bb2528fae3b022cf577b219b/curl/curl-pim-example.sh#L3
  4. https://github.com/j5ik2o/cqrs-es-example-rs/blob/a373f669278c639caebd0b60f7c77ddc68da833a/tools/scripts/curl-post-get-thread.sh#L3
  5. https://github.com/apache/incubator-s2graph/blob/19254301d4cea7e976754fe1b1f6491144b51173/example/common.sh#L63
  6. https://github.com/picodotdev/blog-bitix/blob/337fbe33d9de5a615ca119f5ac11c58967fc8b22/misc/2017/gists/4276fa433729ff8187219939d3218a00/curl-3.sh
  7. https://github.com/crguezl/learning-graphql-with-gh/blob/e5f6561a17a94e5c65f4f648c9b0bebcda70bb1f/hello-graphql/curl-graphql-request-example.sh#L3
  8. https://github.com/uniiverse/graphql-examples/blob/24627605a85395c1d2ff36b99bac983b3a428447/curl/queries_event.sh#L9
  9. https://github.com/msanatan/django_graphql_movies/blob/1cdb19b9e1f18790880d5ef4276d28300b30c21e/actorQuery.sh#L3
  10. https://github.com/atto-byte/yoga2-serverless/blob/10fc780768f3d3cd2a6d14b729aa164d042d577e/api/graphql-curl-example.sh#L3
  11. https://github.com/wandersonwhcr/k8s-examples/blob/26c604f008118cbe5942be173bb3b3b28359b30f/microservices/create-resources.sh#L31
  12. https://github.com/bangarangler/go-jwt-example/blob/7a7244f37c7dca494cd20582c56946b081415a62/curl/createTodo.sh#L23
  13. https://github.com/yakud/apiblog-example/blob/3133bb34e5b7ff4c584be174da35c2d17bba44a2/ping.sh#L47
  14. https://github.com/stevemar/graphql-rest-shopify/blob/5b5ecef5a00f122c42db9c8ed78e2418ba1cd902/bash/main.sh#L42
  15. https://github.com/couchbaselabs/data-api-demos/blob/1fa3c678379ee44a4f79b5ed6f1493ea8f125c17/stepzen/graphql_data_api/stepzen_run.sh
  16. https://github.com/couchbaselabs/data-api-demos/blob/1fa3c678379ee44a4f79b5ed6f1493ea8f125c17/stepzen/graphql_sgw_api/stepzen_run2.sh#L2
  17. https://github.com/couchbaselabs/data-api-demos/blob/1fa3c678379ee44a4f79b5ed6f1493ea8f125c17/stepzen/graphql_data_api_v2/stepzen_run.sh
  18. https://github.com/couchbaselabs/data-api-demos/blob/1fa3c678379ee44a4f79b5ed6f1493ea8f125c17/stepzen/graphql_sgw_api/stepzen_run_admin.sh#L2
  19. https://github.com/karimmakhloufi/docker_integration_test/blob/933016c8079f36a632e987a0a7df2c2b9bbdf020/curl.sh#L2
  20. https://github.com/alexcdot/graphql_pipeline/blob/3e1a455dfe43bdce551b5e1aa7ce80654e638a70/call.sh#L3
  21. https://github.com/eclipse-cdt-cloud/theia-trace-extension/blob/abe6fad756d806e7088cef6d42e387a3c0377f3e/doc/adr/0002/graphql-server-prototype/test#L11
  22. https://github.com/aryansingh920/graphql-express/blob/5abb375a8d98a42d8d7d78acd9d044853e2efead/run.sh#L2
  23. https://github.com/apollographql/supergraph-demo/blob/27c70489e1c9a56c07a917403443dac5da27018b/.scripts/smoke.sh#L44
  24. https://github.com/captaindav/vuer2/blob/af428724f2ef7bf7a150de7b921889352178fb83/scripts/drupal/curlgql.sh
  25. https://github.com/weaviate/weaviate-io/blob/2121df4bdec82e5d489e0d6f2d097309336fdcf6/_includes/code/graphql.additional.sh#L3
  26. https://github.com/joshjohanning/github-misc-scripts/blob/45378395ff643cb6b89a52b77e3e354350bbd8ff/graphql/get-enterprise-id.sh#L5
  27. https://github.com/folio-org/Net-Z3950-FOLIO/blob/3d01d766dea6781f89d685ab089c3af31274a139/doc/graphql/invoke-graphql.sh#L11
  28. https://github.com/heka1024/caliban-sandbox/blob/03935775b05ec49fe161989037642ec484588d09/gr.sh#L2
  29. https://github.com/alapini/protobuf-vs-graphql/blob/c658813725970199bf07a1cf36022c125db6cc12/GraphQLvsgRPC/GraphQL/client.sh#L6
  30. https://github.com/couchbaselabs/data-api-demos/blob/1fa3c678379ee44a4f79b5ed6f1493ea8f125c17/stepzen/graphql_auth/stepzen_run.sh
  31. https://github.com/glowspace/proscholy-phone/blob/c2eff252dfca2de167cdfd1dad8a11d3126d35cd/init_data.sh
  32. https://github.com/pehtoorismies/dt65-weekly-email/blob/d4381399db1a5ee23cb2ec4f16754552623eac8c/sendWeekly.sh#L10
  33. https://github.com/AlicanC/fuel-core/blob/00a39369922589bdd455e1b841179b5de8ef55a6/fuel-indexer/indexer/runnit.sh#L5
  34. https://github.com/svregala/Vector_Database_Sample/blob/07b6e597d91f453902ba268ea4fd41188fb35336/weave-doQuery.sh#L2
  35. https://github.com/apurva13/Information-Retrieval/blob/54c1f5a02e3d5863aa34d6aad9a1f3595b6e4444/weave-doQuery.sh#L2
  36. https://github.com/svregala/Vector_Database_Sample/blob/07b6e597d91f453902ba268ea4fd41188fb35336/weave-doQuery.sh#L2
  37. https://github.com/TrueBlocks/tokenomics.io/blob/256c9a0d8c821107a283ab7c8dc0e93720e1dabd/giveth/docs/query_one.sh#L3
  38. https://github.com/ruch0401/CSCI572-InformationRetrievalAndWebSearchEngines/blob/00bae161f32f8aba5cad866aa4c662f51480f2c6/hw5/weave-doQuery.sh#L2
  39. https://github.com/graphprotocol/erc20-subgraph/blob/e4e4b5d3b6e83678a2033f65e31e81c8d29749a6/scripts/tokens-uniswap.sh
  40. https://github.com/luker983/hackthebox/blob/972b5f71fe99edd7897d7fae978c620d378ca592/Machines/Help/exploit/query.sh#L4
  41. https://github.com/podhmo/individual-sandbox/blob/c29035c28b27adebbc8a9f7b0d6d1a5c02c30482/daily/20200219/example_githubapi/02req.bash
  42. https://github.com/podhmo/individual-sandbox/blob/c29035c28b27adebbc8a9f7b0d6d1a5c02c30482/daily/20200219/example_githubapi/01req.bash
  43. https://github.com/CrystallizeAPI/code-snippets/blob/533451598a155591bb2528fae3b022cf577b219b/curl/curl-core-example.sh#L2
  44. https://github.com/ferboiar/wrt32x/blob/9c7da6afc7a8400a7232171795a8af1e3f6b2e18/scripts/functions.sh#L102
  45. https://github.com/caffeinetv/caffeine-obs-plugin/blob/7774dc5a024ebb40f2f2ade85f5f19eb94dbaa5c/scripts/generate-graphql-types.sh#L11
  46. https://github.com/BuildAPKs/buildAPKs.api/blob/a1ec7cbb9325ee0641367dcd45934b4761987d87/github/scripts/queries/static/schema.sh#L6
  47. https://github.com/douglasnaphas/queries/blob/59d8c4304bccadacf9fc810557112326d781bd48/github/graphql/viewer.sh#L6
  48. https://github.com/dxos/dxns-cosmos/blob/7324a1a2564fef323fe73841cc539255d6b1a683/scripts/lite/server.sh#L113

jq being used for parsing:

  1. https://github.com/SCOREC/EnGPar/blob/86e5fa5131528652e32e33409024cfb9cdadd8b0/metrics/getRepoStats.sh#L72
  2. https://github.com/Custler/TestScripts/blob/5e822b503787e7a9963a3783fae1d019e5c7c44a/scripts/functions.shinc#L258
  3. https://github.com/NEWSOROS/custler.uninode/blob/c2a15966219db8289cda5bbbf7b59c24befc789b/scripts/functions.shinc#L238
  4. https://github.com/Everscale-Network/main.evs.dev/blob/ad9f9ac5b821a6457c9b19973b8e87345cd5a982/scripts/functions.shinc#L258
  5. https://github.com/musienko-maxim/che-operator/blob/d104845f8987d6b77bf4b2bb1563bb51540e78e8/olm/release-olm-files.sh#L33
  6. https://github.com/viranch/scripts/blob/3b1f28de3797c56311a41488c223ce452f1207d0/bin/cs-debug#L5
  7. https://github.com/vaporyorg/dex-utils/blob/ee65876a97107290bc18e27725f191a00502aa1b/prices.sh#L25
  8. https://github.com/viranch/scripts/blob/3b1f28de3797c56311a41488c223ce452f1207d0/bin/cs#L5
  9. https://github.com/redbadger/futurenhs-platform/blob/3a41697f0316a28aa4197c752c002ca9695f8faa/workspace-service/scripts/create-folder-if-needed.sh#L33
  10. https://github.com/felipesere/oak/blob/dc9ae36205709f55d58988596aa6741953661ff4/bin/legendaries.sh#L2
  11. https://github.com/RostiMelk/linear-branch-matcher/blob/4d8c7bce184876dca2ab67a9bb363194b3bb29b0/linear-branch-matcher.sh#L22
  12. https://github.com/CodingOnChain/bash-light-wallet/blob/28ae6be8ed3a52fa200e2a28212d703ebe8df537/xxx-get-current-slot.sh#L2
  13. https://github.com/metlos/che-operator/blob/d17965597500cdca9afb6ae0ce299dd6fd5f8b1e/olm/release-olm-files.sh#L26
  14. https://github.com/balajikrishnannewsuk/styleplay-performance/blob/8f95bf632d50763c7d8d4324c7cc870a46507167/scripts/generate-data-sources#L23
  15. https://github.com/Khaos-Labs/khaos-wallet-core/blob/2c06d49fddf978e0815b208dddef50ee2011c551/typescript/tools/check-gpr-version#L10
  16. https://github.com/minatools/mina/blob/0612b142738c68155e9a9bba16cd3787bba4feed/dockerfiles/scripts/healthcheck-utilities.sh#L6
  17. https://github.com/spector-in-london/mina/blob/585c76fc631616a65c1c8eb067c625376d498ad2/dockerfiles/scripts/healthcheck-utilities.sh#L7
  18. https://github.com/Custler/main.evs.dev/blob/6a18416323dc4e5d9e2a64429f48b7f07aa6515e/scripts/functions.shinc#L265
  19. https://github.com/scottrigby/cf-github-pr-export/blob/c1d0a0000fe08750d24a709fbb0443968b3603d7/cf-github-pr-export#L13
  20. https://github.com/ascdso2020/ascdso-eclipse-che-operator/blob/7f7bcf898ba67e92814f8a60fcac5e07e8f454d3/olm/release-olm-files.sh#L32
  21. https://github.com/vulcanize/dxns/blob/c736a2908785e8399364fb31b1606a00693e59ea/scripts/server.sh#L63
  22. https://github.com/bohendo/valuemachine/blob/419f372f32d5771c4025abbd6e11c0fe16b51cf7/ops/query-subgraph.sh#L40
  23. https://github.com/snarfed/misc/blob/ae6a20330669550fa08b1dffaf7090c58543511e/asanafy_pr.sh#L68
  24. https://github.com/gnosis/dex-subgraph/blob/85ebf3c637c849b1069c7d71e993e21fe7b45294/e2e/ci.sh#L38
  25. https://github.com/crustio/nodes_scripts/blob/394df86d3946d644c73c1f62238fa3ad351eadd4/get_old_order.sh#L198
  26. https://github.com/Custler/main.evs.dev/blob/6a18416323dc4e5d9e2a64429f48b7f07aa6515e/scripts/INFO_Val.sh#L98
  27. https://github.com/IBM/wazi-codeready-workspaces-operator/blob/34a8985098930878277c7ed80a20b2c2e12e9ec7/olm/release-olm-files.sh#L26
  28. https://github.com/Arial-Z/Plex-Romaji-Renamer/blob/df0d725b93f64a57315e683a91669aadbe36e00d/seasonal-animes-download.sh#L34
  29. https://github.com/Everscale-Network/custler.uninode/blob/b843e53b116a81cb91cf49a91cfdd6dddf3ef9b6/scripts/functions.shinc#L258
  30. https://github.com/Everscale-Network/custler.uninode/blob/b843e53b116a81cb91cf49a91cfdd6dddf3ef9b6/scripts/OldBlkAddr.sh#L78
  31. https://github.com/crustio/nodes_scripts/blob/394df86d3946d644c73c1f62238fa3ad351eadd4/recover_illegal_file_all_graph.sh#L19
  32. https://github.com/asnov/custler.uninode/blob/e70716339f77f361a94bcb27cc6c60e5c9add7e8/scripts/INFO_Val.sh#L98
  33. https://github.com/vaporyorg/dex-utils/blob/ee65876a97107290bc18e27725f191a00502aa1b/orders.sh#L96
  34. https://github.com/jaybuidl/kleros-scripts/blob/60acf3dd4aece477fc779afa727d452bc0962d69/scripts/getAddressForTag.sh#L13
  35. https://github.com/api3dao/api3-subgraph/blob/7ac83bce28a6569e81e1d8a54e3d88c97f7b1cec/scripts/deploy-public-chain.sh#L86
  36. https://github.com/DanySK/kotlin-container/blob/2252ace0aa1323946fbf635c9c8e5ea6f854917f/print-kotlin-versions.sh#L3
  37. https://github.com/JusticeInternational/project-config/blob/2196e4e9eff22566c9fdf85b8a9a8fca393f6a82/config/hc-backoffice/demo/bootstrap.sh#L22
  38. https://github.com/mbtamuli/playground/blob/5c095308e88ca04534d1a68a136c74b0ef7bf86a/bash/gitlab-group-clone.sh#L8
  39. https://github.com/Arial-Z/Animes-ID/blob/8000957b9598ec5c5f11f6f9de03e3a9e03476d4/animes-id.sh#L117
  40. https://github.com/bogdal/export-github-org-gpg-keys/blob/a573d74e24637f166c5b1f481e19991a6511e324/export-org-keys.sh#L18
  41. https://github.com/gattytto/che-operator/blob/23f0d72b451afb6bcd339daa976ba1b21ac8fe1e/olm/release-olm-files.sh#L26
  42. https://github.com/flacatus/che-operator/blob/8528378fd8bd50982525897118a6799b1412c5ab/olm/release-olm-files.sh#L26

jshon being used for parsing:

  1. https://github.com/makerdao/setzer-mcd/blob/5f6a183fd8c9aa035795a72810c4df1e8963a73e/libexec/setzer/setzer-x-price#L55

python json.tool used for parsing:

  1. https://github.com/asermax/catering-colectivo/blob/5214a3bc443707e65431019b092147e5696ce038/api/update_gql_schema.sh#L5


sed being used for parsing:

  1. https://github.com/abema/abema-ios-tutorial-public/blob/7635f8dc9cfbf031e747b99b3a838f4568f3eb53/scripts/ci/git-deepen.sh#L77

grep being used for parsing:

  1. https://github.com/samscott89/supergraph-demo/blob/c707706e71aa85395d3d24fd97c4ce1c36d3c356/.scripts/smoke.sh#L45
  2. https://github.com/WenyXu/supergraph-demo-fed2/blob/83448189fff3e4aa893bfeeb01f153ad09b1fb40/.scripts/smoke.sh#L45
  3. https://github.com/prasek/supergraph-demo-fed2/blob/f9b6f210bb9b3354973c0c1c288d6b955d1800f0/.scripts/smoke.sh#L45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment