Connect a GitHub repository
curl --request PUT \
--url https://api.spreadjam.com/v1/destinations/{destinationId}/github \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "acme",
"name": "website",
"baseBranch": "main",
"contentRoot": "content/blog",
"publicRoutePattern": "https://example.com/blog/{slug}"
}
'import requests
url = "https://api.spreadjam.com/v1/destinations/{destinationId}/github"
payload = {
"owner": "acme",
"name": "website",
"baseBranch": "main",
"contentRoot": "content/blog",
"publicRoutePattern": "https://example.com/blog/{slug}"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: 'acme',
name: 'website',
baseBranch: 'main',
contentRoot: 'content/blog',
publicRoutePattern: 'https://example.com/blog/{slug}'
})
};
fetch('https://api.spreadjam.com/v1/destinations/{destinationId}/github', 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.spreadjam.com/v1/destinations/{destinationId}/github",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => 'acme',
'name' => 'website',
'baseBranch' => 'main',
'contentRoot' => 'content/blog',
'publicRoutePattern' => 'https://example.com/blog/{slug}'
]),
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.spreadjam.com/v1/destinations/{destinationId}/github"
payload := strings.NewReader("{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.spreadjam.com/v1/destinations/{destinationId}/github")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/destinations/{destinationId}/github")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}"
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"repository": "acme/website",
"baseBranch": "<string>",
"contentRoot": "<string>",
"publicRoutePattern": "<string>",
"fileExtension": "<string>",
"requiredFrontmatter": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}Destinations
Connect a GitHub repository
Connect the destination to a repository: Jam checks the repository, branch and content folder, detects how its articles are written, and stores the configuration. Configuring again replaces it. Requires a paid plan.
PUT
/
v1
/
destinations
/
{destinationId}
/
github
Connect a GitHub repository
curl --request PUT \
--url https://api.spreadjam.com/v1/destinations/{destinationId}/github \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "acme",
"name": "website",
"baseBranch": "main",
"contentRoot": "content/blog",
"publicRoutePattern": "https://example.com/blog/{slug}"
}
'import requests
url = "https://api.spreadjam.com/v1/destinations/{destinationId}/github"
payload = {
"owner": "acme",
"name": "website",
"baseBranch": "main",
"contentRoot": "content/blog",
"publicRoutePattern": "https://example.com/blog/{slug}"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: 'acme',
name: 'website',
baseBranch: 'main',
contentRoot: 'content/blog',
publicRoutePattern: 'https://example.com/blog/{slug}'
})
};
fetch('https://api.spreadjam.com/v1/destinations/{destinationId}/github', 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.spreadjam.com/v1/destinations/{destinationId}/github",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => 'acme',
'name' => 'website',
'baseBranch' => 'main',
'contentRoot' => 'content/blog',
'publicRoutePattern' => 'https://example.com/blog/{slug}'
]),
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.spreadjam.com/v1/destinations/{destinationId}/github"
payload := strings.NewReader("{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.spreadjam.com/v1/destinations/{destinationId}/github")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spreadjam.com/v1/destinations/{destinationId}/github")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"acme\",\n \"name\": \"website\",\n \"baseBranch\": \"main\",\n \"contentRoot\": \"content/blog\",\n \"publicRoutePattern\": \"https://example.com/blog/{slug}\"\n}"
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"repository": "acme/website",
"baseBranch": "<string>",
"contentRoot": "<string>",
"publicRoutePattern": "<string>",
"fileExtension": "<string>",
"requiredFrontmatter": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"docs": "<string>",
"resolveUrl": "<string>",
"details": [
{}
]
}Authorizations
A workspace API key issued in Settings → Developer, sent as Bearer sk_….
Path Parameters
Example:
"a3bb189e-8bf9-4888-9912-ace4e6543002"
Body
application/json
Minimum string length:
1Example:
"acme"
Minimum string length:
1Example:
"website"
Minimum string length:
1Example:
"main"
The folder articles live in.
Minimum string length:
1Example:
"content/blog"
The address an article is published at, with {slug} where its slug goes.
Minimum string length:
1Example:
"https://example.com/blog/{slug}"