diff options
Diffstat (limited to 'doc/api/graphql/getting_started.md')
-rw-r--r-- | doc/api/graphql/getting_started.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/api/graphql/getting_started.md b/doc/api/graphql/getting_started.md index 258f781528b..386ef6c403b 100644 --- a/doc/api/graphql/getting_started.md +++ b/doc/api/graphql/getting_started.md @@ -26,6 +26,7 @@ local computer. A GraphQL request can be made as a `POST` request to `/api/graph with the query as the payload. You can authorize your request by generating a [personal access token](../../user/profile/personal_access_tokens.md) to use as a bearer token. +This token requires at least the `read_api` scope. Example: @@ -36,6 +37,16 @@ curl "https://gitlab.com/api/graphql" --header "Authorization: Bearer $GRAPHQL_T --data "{\"query\": \"query {currentUser {name}}\"}" ``` +To nest strings in the query string, +wrap the data in single quotes or escape the strings with `\\`: + +```shell +curl "https://gitlab.com/api/graphql" --header "Authorization: Bearer $GRAPHQL_TOKEN" \ + --header "Content-Type: application/json" --request POST \ + --data '{"query": "query {project(fullPath: \"<group>/<subgroup>/<project>\") {jobs {nodes {id duration}}}}"}' + # or "{\"query\": \"query {project(fullPath: \\\"<group>/<subgroup>/<project>\\\") {jobs {nodes {id duration}}}}\"}" +``` + ### GraphiQL GraphiQL (pronounced "graphical") allows you to run queries directly against |