curl --request POST \
--url https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "github",
"urlPrefix": "<string>",
"installationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repositoryId": 2,
"branch": "<string>",
"folder": "<string>"
}
'import requests
url = "https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources"
payload = {
"provider": "github",
"urlPrefix": "<string>",
"installationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repositoryId": 2,
"branch": "<string>",
"folder": "<string>"
}
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({
provider: 'github',
urlPrefix: '<string>',
installationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
repositoryId: 2,
branch: '<string>',
folder: '<string>'
})
};
fetch('https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources', 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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources",
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([
'provider' => 'github',
'urlPrefix' => '<string>',
'installationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'repositoryId' => 2,
'branch' => '<string>',
'folder' => '<string>'
]),
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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources"
payload := strings.NewReader("{\n \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources")
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 \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"source": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "github",
"urlPrefix": "<string>",
"repository": "<string>",
"branch": "<string>",
"folder": "<string>",
"format": "mintlify",
"status": "active",
"reconnectReason": "installation",
"autoPullRequests": true,
"githubAccount": "<string>"
}
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}Add a content source
Maps a site URL prefix onto a GitHub repository folder (provider github, with installationId from getContentSources and repositoryId from listContentRepositories) or a GitBook space (provider gitbook, with connectionId, siteId and spaceId), with the checks Settings makes: GitHub must reach the repository, branch and folder, and the format is detected; the GitBook token must edit the space and GitBook must publish it at urlPrefix. Returns the source as the add recorded it, added by the member the key acts as. A failed check carries its reason: 400 invalid_prefix, invalid_folder, invalid_space, repository_unreachable, branch_not_found, folder_not_found, space_not_found, cannot_edit or prefix_not_published; 409 spaces_incomplete or cannot_list_sites. A prefix a live source already covers, a retry included, is 409 prefix_taken. An installationId or connectionId the account does not have is 404. One that is not active, or that GitHub refuses (a suspended app or an organization IP allow list), is 409 not_connected, and a rejected GitBook token 409 token_rejected, each with details.settingsUrl, the Settings page where a person reconnects it. Without content pull requests it is 403 content_pull_requests_unavailable, with details.settingsUrl, the account billing page. details.settingsUrl is null when no link can be built. A key whose member is not in the project or cannot manage DevTune is 403 cannot_manage_content. A GitHub or GitBook rate limit or outage is 503 with Retry-After. Requires the setup.write scope.
curl --request POST \
--url https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "github",
"urlPrefix": "<string>",
"installationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repositoryId": 2,
"branch": "<string>",
"folder": "<string>"
}
'import requests
url = "https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources"
payload = {
"provider": "github",
"urlPrefix": "<string>",
"installationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repositoryId": 2,
"branch": "<string>",
"folder": "<string>"
}
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({
provider: 'github',
urlPrefix: '<string>',
installationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
repositoryId: 2,
branch: '<string>',
folder: '<string>'
})
};
fetch('https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources', 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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources",
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([
'provider' => 'github',
'urlPrefix' => '<string>',
'installationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'repositoryId' => 2,
'branch' => '<string>',
'folder' => '<string>'
]),
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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources"
payload := strings.NewReader("{\n \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\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://devtune.ai/api/v2/projects/{projectId}/setup/content-sources")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devtune.ai/api/v2/projects/{projectId}/setup/content-sources")
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 \"provider\": \"github\",\n \"urlPrefix\": \"<string>\",\n \"installationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"repositoryId\": 2,\n \"branch\": \"<string>\",\n \"folder\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"source": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "github",
"urlPrefix": "<string>",
"repository": "<string>",
"branch": "<string>",
"folder": "<string>",
"format": "mintlify",
"status": "active",
"reconnectReason": "installation",
"autoPullRequests": true,
"githubAccount": "<string>"
}
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}Authorizations
Path Parameters
Body
- Option 1
- Option 2