Connect a GitHub repository
curl --request POST \
--url https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo": "acme/shop-site",
"branch": "main",
"autoDeploy": true,
"installationId": 2,
"token": "<string>"
}
'import requests
url = "https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect"
payload = {
"repo": "acme/shop-site",
"branch": "main",
"autoDeploy": True,
"installationId": 2,
"token": "<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({
repo: 'acme/shop-site',
branch: 'main',
autoDeploy: true,
installationId: 2,
token: '<string>'
})
};
fetch('https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect', 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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect",
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([
'repo' => 'acme/shop-site',
'branch' => 'main',
'autoDeploy' => true,
'installationId' => 2,
'token' => '<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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect"
payload := strings.NewReader("{\n \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect")
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 \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {},
"message": "<string>"
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}Workspace
Connect a GitHub repository
POST
/
api
/
v2
/
shops
/
{shopId}
/
workspace
/
git
/
connect
Connect a GitHub repository
curl --request POST \
--url https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo": "acme/shop-site",
"branch": "main",
"autoDeploy": true,
"installationId": 2,
"token": "<string>"
}
'import requests
url = "https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect"
payload = {
"repo": "acme/shop-site",
"branch": "main",
"autoDeploy": True,
"installationId": 2,
"token": "<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({
repo: 'acme/shop-site',
branch: 'main',
autoDeploy: true,
installationId: 2,
token: '<string>'
})
};
fetch('https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect', 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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect",
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([
'repo' => 'acme/shop-site',
'branch' => 'main',
'autoDeploy' => true,
'installationId' => 2,
'token' => '<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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect"
payload := strings.NewReader("{\n \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<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://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://itemshop.dev/api/v2/shops/{shopId}/workspace/git/connect")
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 \"repo\": \"acme/shop-site\",\n \"branch\": \"main\",\n \"autoDeploy\": true,\n \"installationId\": 2,\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {},
"message": "<string>"
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Error message",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Shop ID (ObjectId)
Body
application/json
Pattern:
^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$Example:
"acme/shop-site"
Required string length:
1 - 200Example:
"main"
Omitted: token when token is given, otherwise app with a verified installation that can see the repo.
Available options:
app, token App mode: installation id verified via /git/install
Required range:
x >= 1Token mode: fine-grained PAT
Required string length:
20 - 255Pattern:
^(github_pat_|ghp_)[A-Za-z0-9_]+$Was this page helpful?
⌘I