Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bash-rest-api-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
bash-rest-api-client
Merge requests
!5
Extend authorization: update docs and help
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Extend authorization: update docs and help
extend-authorization
into
master
Overview
0
Commits
4
Pipelines
0
Changes
1
Merged
Hahn Axel (hahn)
requested to merge
extend-authorization
into
master
6 months ago
Overview
0
Commits
4
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
663b846a
Prev
Next
Show latest version
1 file
+
25
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
663b846a
add example with custom header (Gitlab)
· 663b846a
Hahn Axel (hahn)
authored
6 months ago
docs/40_Examples.md
+
25
−
0
Options
@@ -164,3 +164,28 @@ http.setAuth
@@ -164,3 +164,28 @@ http.setAuth
http.makeRequest GET
"api"
http.makeRequest GET
"api"
http.makeRequest GET
"app"
http.makeRequest GET
"app"
```
```
## Gitlab access token
Gitlab uses the value
`PRIVATE-TOKEN: <token>`
in the request header for authorization.
Here we need
`http.addHeader`
to add a custom header line.
```
sh
URL
=
'https://gitlab.example.com/api/v4'
TOKEN
=
'<add-your-token-here>'
# glpat-**********
# ---------- init
http.init
http.addHeader
"PRIVATE-TOKEN:
$TOKEN
"
http.setBaseUrl
"
$URL
"
# ---------- Requests to api
http.makeRequest /users
http.getResponse | jq
http.makeRequest /projects
http.getResponse | jq
```
Loading