Connect any GitLab with a personal access token
curl --request POST \
--url https://pria.praxislxp.com/api/user/agents/connect/gitlab/token \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"pat": "glpat-…",
"baseUrl": "https://gitlab.example.org"
}
'import requests
url = "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token"
payload = {
"pat": "glpat-…",
"baseUrl": "https://gitlab.example.org"
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({pat: 'glpat-…', baseUrl: 'https://gitlab.example.org'})
};
fetch('https://pria.praxislxp.com/api/user/agents/connect/gitlab/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pat' => 'glpat-…',
'baseUrl' => 'https://gitlab.example.org'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token"
payload := strings.NewReader("{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pria.praxislxp.com/api/user/agents/connect/gitlab/token")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pria.praxislxp.com/api/user/agents/connect/gitlab/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"connection": {
"host": "gitlab.example.org",
"baseUrl": "https://gitlab.example.org",
"kind": "oauth",
"login": "cat",
"scopes": [
"api",
"write_repository"
],
"expiresAt": "2023-11-07T05:31:56Z",
"connectedAt": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"code": "GIT_NOT_CONFIGURED",
"message": "<string>"
}{
"success": false,
"code": "GIT_NOT_CONFIGURED",
"message": "<string>"
}Git connections
Connect any GitLab with a personal access token
Checks the token against the GitLab at baseUrl (default https://gitlab.com; public https only, no redirects) and stores it encrypted. The token needs the api and write_repository scopes. Disconnecting later forgets the token but does not revoke it (it is the person’s own).
POST
/
api
/
user
/
agents
/
connect
/
gitlab
/
token
Connect any GitLab with a personal access token
curl --request POST \
--url https://pria.praxislxp.com/api/user/agents/connect/gitlab/token \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"pat": "glpat-…",
"baseUrl": "https://gitlab.example.org"
}
'import requests
url = "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token"
payload = {
"pat": "glpat-…",
"baseUrl": "https://gitlab.example.org"
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({pat: 'glpat-…', baseUrl: 'https://gitlab.example.org'})
};
fetch('https://pria.praxislxp.com/api/user/agents/connect/gitlab/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pat' => 'glpat-…',
'baseUrl' => 'https://gitlab.example.org'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pria.praxislxp.com/api/user/agents/connect/gitlab/token"
payload := strings.NewReader("{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pria.praxislxp.com/api/user/agents/connect/gitlab/token")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pria.praxislxp.com/api/user/agents/connect/gitlab/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pat\": \"glpat-…\",\n \"baseUrl\": \"https://gitlab.example.org\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"connection": {
"host": "gitlab.example.org",
"baseUrl": "https://gitlab.example.org",
"kind": "oauth",
"login": "cat",
"scopes": [
"api",
"write_repository"
],
"expiresAt": "2023-11-07T05:31:56Z",
"connectedAt": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"code": "GIT_NOT_CONFIGURED",
"message": "<string>"
}{
"success": false,
"code": "GIT_NOT_CONFIGURED",
"message": "<string>"
}Authorizations
JWT token passed in x-access-token header
Body
application/json
Was this page helpful?