Create component
curl --request POST \
--url https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Backend API",
"pathGlobs": "src/api/**",
"description": "Core backend API services"
}
'import requests
url = "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components"
payload = {
"name": "Backend API",
"pathGlobs": "src/api/**",
"description": "Core backend API services"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Backend API',
pathGlobs: 'src/api/**',
description: 'Core backend API services'
})
};
fetch('https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components', 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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components",
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([
'name' => 'Backend API',
'pathGlobs' => 'src/api/**',
'description' => 'Core backend API services'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components"
payload := strings.NewReader("{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Backend API",
"description": "Core backend API services",
"pathGlobs": "src/api/**"
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}Components
Create component
Create a Component for a Project. Requires admin access to the Project, and the Project must have Components enabled.
POST
/
gh
/
{ownerKeyOrId}
/
projects
/
{projectKeyOrId}
/
components
Create component
curl --request POST \
--url https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Backend API",
"pathGlobs": "src/api/**",
"description": "Core backend API services"
}
'import requests
url = "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components"
payload = {
"name": "Backend API",
"pathGlobs": "src/api/**",
"description": "Core backend API services"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Backend API',
pathGlobs: 'src/api/**',
description: 'Core backend API services'
})
};
fetch('https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components', 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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components",
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([
'name' => 'Backend API',
'pathGlobs' => 'src/api/**',
'description' => 'Core backend API services'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components"
payload := strings.NewReader("{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Backend API\",\n \"pathGlobs\": \"src/api/**\",\n \"description\": \"Core backend API services\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Backend API",
"description": "Core backend API services",
"pathGlobs": "src/api/**"
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}Authorizations
Generate an API token at https://qlty.sh/user/settings/tokens
Path Parameters
Repository owner name (login) or workspace ID
Minimum string length:
3Example:
"acme-corp"
Repository name or project ID
Minimum string length:
3Example:
"my-repo"
Body
application/json
Component definition
Response
The created component
⌘I