diff --git a/docs/40_Examples.md b/docs/40_Examples.md index 785e054538822f1223d295cd05ddedc00b577e5f..1a8c8577d912a6d17092f0f1ab7d82a2705fca56 100644 --- a/docs/40_Examples.md +++ b/docs/40_Examples.md @@ -164,3 +164,28 @@ http.setAuth http.makeRequest GET "api" 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 + +```