API Reference Disconnect GitHub
Disconnect GitHub
Move a GitHub project back into Syntext, copying the repository's pages in, or cancel a pending link.
Session token
Make a GitHub project a project written in Syntext again. The pages in the repository's docs folder, its syntext.json and its images are copied into Syntext as a new revision, so you keep editing in the browser from where the repository left off. The live site doesn't change — it keeps the deploy it has until you next publish.
Note
Requires the admin or owner role and a session JWT. The repository and its files are not changed.
No request body.
Response — 200 OK
NameDescription
revisionThe new revision (
source: "github-snapshot"), or null when Syntext already held the same files.commitShaThe repository commit the pages were copied from.
filesPages, config files and images copied in, and files in Syntext that the repository no longer had (deleted in the new revision; still in history).
skippedRepository files that couldn't come in, with the reason — for example a page over 1 MB, an image over 5 MB, or an SVG that failed sanitising.
unpublishedChangestrue when the live site was built from a different commit. Publish to bring it up to the copied pages.cancelledPresent when the call cancelled a link that hadn't finished — a pending pull request, or a failed move. Nothing is copied;
pullRequest names the pull request, which stays open on GitHub.Error Responses
| Status | Code | When |
|---|---|---|
| 403 | forbidden | You're not an admin or owner |
| 409 | not_linked | The project isn't linked to a GitHub repository |
| 409 | branch_not_found | The project's branch no longer exists, so its pages can't be copied. Restore it, or choose another branch first |
| 413 | content_too_large | The repository's docs are over 200 MB |
| 413 | too_many_files | The repository's docs hold more than 2,000 files |
| 502 | github_error | GitHub refused a request |
Was this page helpful? Yes No
Previous
Request
bashJavaScriptPythonGoRubyPHPJavaC#bash
curl -X POST https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const response = await fetch('https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect', {
method: 'POST',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIs...',
},
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect"
headers = {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIs...",
}
response = requests.post(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("POST", "https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzI1NiIs...")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "net/http"
require "uri"
uri = URI("https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer eyJhbGciOiJIUzI1NiIs..."
response = http.request(request)
puts response.code
puts response.body
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer eyJhbGciOiJIUzI1NiIs...',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect"))
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIs...")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.syntext.dev/v1/projects/3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c/source/github/disconnect");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer eyJhbGciOiJIUzI1NiIs...");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200OK
{
"data": {
"contentSource": "hosted",
"revision": { "id": "2a9d4f1c-8e3b-4c7a-9f2e-6b1d5c8a3e40", "number": 15 },
"commitSha": "9d4e1b7c3a5f8e2d6b0c4a9f1e7d3b5c8a2f6e0d",
"files": { "pages": 18, "config": 1, "images": 6, "deleted": 0 },
"skipped": [],
"liveSite": "unchanged",
"unpublishedChanges": false
}
}