Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/graphql/getting_started.md')
-rw-r--r--doc/api/graphql/getting_started.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/api/graphql/getting_started.md b/doc/api/graphql/getting_started.md
index 20fb2f030f2..1945f528d67 100644
--- a/doc/api/graphql/getting_started.md
+++ b/doc/api/graphql/getting_started.md
@@ -18,6 +18,7 @@ The examples documented here can be run using:
- The command line.
- GraphiQL.
+- Rails console.
### Command line
@@ -73,6 +74,27 @@ NOTE:
If you are running GitLab 12.0, enable the `graphql`
[feature flag](../features.md#set-or-create-a-feature).
+### Rails console **(FREE SELF)**
+
+GraphQL queries can be run in a [Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session). For example, to search projects:
+
+```ruby
+query = <<~EOQ
+query securityGetProjects($search: String!) {
+ projects(search: $search) {
+ nodes {
+ path
+ }
+ }
+}
+EOQ
+
+variables = { "search": "gitlab" }
+
+result = GitlabSchema.execute(query, variables: variables, context: { current_user: current_user })
+result.to_h
+```
+
## Queries and mutations
The GitLab GraphQL API can be used to perform: