Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
f81cdf86
Verified
Commit
f81cdf86
authored
6 months ago
by
Luke Duncalfe
Committed by
GitLab
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Clarify object identifiers in public GraphQL docs
#452465
parent
69231a85
No related branches found
No related tags found
2 merge requests
!164749
Enable parallel in test-on-omnibus
,
!163691
Clarify object identifiers in public GraphQL docs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/api/graphql/index.md
+54
-1
54 additions, 1 deletion
doc/api/graphql/index.md
with
54 additions
and
1 deletion
doc/api/graphql/index.md
+
54
−
1
View file @
f81cdf86
...
...
@@ -124,9 +124,62 @@ Signing in to the main GitLab application sets a `_gitlab_session` session cooki
The
[
interactive GraphQL explorer
](
#interactive-graphql-explorer
)
and the web frontend of
GitLab itself use this method of authentication.
## Object identifiers
The GitLab GraphQL API uses a mix of identifiers.
[
Global IDs
](
#global-ids
)
, full paths, and internal IDs (IIDs) are all used as arguments in the GitLab
GraphQL API, but often a particular part of schema does not accept all of these at the same time.
Although the GitLab GraphQL API has historically not been consistent on this, in general you can expect:
-
If the object is a project, group, or namespace, you use the object's full path.
-
If an object has an IID, you use a combination of full path and IID.
-
For other objects, you use a
[
Global ID
](
#global-ids
)
.
For example, finding a project by its full path
`"gitlab-org/gitlab"`
:
```
graphql
{
project
(
fullPath
:
"gitlab-org/gitlab"
)
{
id
fullPath
}
}
```
Another example, locking an issue by its project's full path
`"gitlab-org/gitlab"`
and the issue's IID
`"1"`
":
```
graphql
mutation
{
issueSetLocked
(
input
:
{
projectPath
:
"gitlab-org/gitlab"
,
iid
:
"1"
,
locked
:
true
})
{
issue
{
id
iid
}
}
}
```
An example of finding a CI runner by its Global ID:
```
graphql
{
runner
(
id
:
"gid://gitlab/Ci::Runner/1"
)
{
id
}
}
```
Historically, the GitLab GraphQL API has been inconsistent with typing of full path and
IID fields and arguments, but generally:
-
Full path fields and arguments are a GraphQL
`ID`
type .
-
IID fields and arguments are a GraphQL
`String`
type.
### Global IDs
In the GitLab GraphQL API, a
n
`id`
field is nearly always a
[
Global ID
](
https://graphql.org/learn/global-object-identification/
)
In the GitLab GraphQL API, a field
or argument named
`id`
is nearly always a
[
Global ID
](
https://graphql.org/learn/global-object-identification/
)
and never a database primary key ID. A Global ID in the GitLab GraphQL API
begins with
`"gid://gitlab/"`
. For example,
`"gid://gitlab/Issue/123"`
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment