Create bases
curl --request POST \
--url https://api.dittowords.com/v2/bases \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"name": "Web App",
"developerId": "web-app",
"githubRepo": "dittowords/web-app"
},
{
"name": "Mobile App"
}
]
'import requests
url = "https://api.dittowords.com/v2/bases"
payload = [{
"name": "Web App",
"developerId": "web-app",
"githubRepo": "dittowords/web-app"
}, { "name": "Mobile App" }]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{name: 'Web App', developerId: 'web-app', githubRepo: 'dittowords/web-app'},
{name: 'Mobile App'}
])
};
fetch('https://api.dittowords.com/v2/bases', 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.dittowords.com/v2/bases",
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' => 'Web App',
'developerId' => 'web-app',
'githubRepo' => 'dittowords/web-app'
],
[
'name' => 'Mobile App'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.dittowords.com/v2/bases"
payload := strings.NewReader("[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.dittowords.com/v2/bases")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/bases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"name": "Web App",
"id": "web-app",
"githubConnection": {
"repoId": 123456789,
"owner": "dittowords",
"repo": "web-app"
},
"scan": {
"id": "6a1f3c9e2b7d4e0012a8f5c3",
"url": "https://app.dittowords.com/scan/6a1f3c9e2b7d4e0012a8f5c3"
}
},
{
"name": "Mobile App",
"id": "mobile-app",
"githubConnection": null,
"scan": null
}
]{
"message": "Duplicate developer ID found: web-app"
}{
"message": "Could not find GitHub repository with name 'dittowords/web-app'"
}Bases
Create bases
Creates one or more bases in your workspace.
Pass githubRepo to attach a GitHub repository to a base as it’s created. The repository must already be available to Ditto’s GitHub app in your workspace, and each repository can only be attached to one base. Attaching a repository also kicks off an initial scan of it.
BETA This endpoint is part of a feature that is still in development and will not be available until the feature has been released.
POST
/
bases
Create bases
curl --request POST \
--url https://api.dittowords.com/v2/bases \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"name": "Web App",
"developerId": "web-app",
"githubRepo": "dittowords/web-app"
},
{
"name": "Mobile App"
}
]
'import requests
url = "https://api.dittowords.com/v2/bases"
payload = [{
"name": "Web App",
"developerId": "web-app",
"githubRepo": "dittowords/web-app"
}, { "name": "Mobile App" }]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{name: 'Web App', developerId: 'web-app', githubRepo: 'dittowords/web-app'},
{name: 'Mobile App'}
])
};
fetch('https://api.dittowords.com/v2/bases', 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.dittowords.com/v2/bases",
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' => 'Web App',
'developerId' => 'web-app',
'githubRepo' => 'dittowords/web-app'
],
[
'name' => 'Mobile App'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.dittowords.com/v2/bases"
payload := strings.NewReader("[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.dittowords.com/v2/bases")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/bases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"name\": \"Web App\",\n \"developerId\": \"web-app\",\n \"githubRepo\": \"dittowords/web-app\"\n },\n {\n \"name\": \"Mobile App\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"name": "Web App",
"id": "web-app",
"githubConnection": {
"repoId": 123456789,
"owner": "dittowords",
"repo": "web-app"
},
"scan": {
"id": "6a1f3c9e2b7d4e0012a8f5c3",
"url": "https://app.dittowords.com/scan/6a1f3c9e2b7d4e0012a8f5c3"
}
},
{
"name": "Mobile App",
"id": "mobile-app",
"githubConnection": null,
"scan": null
}
]{
"message": "Duplicate developer ID found: web-app"
}{
"message": "Could not find GitHub repository with name 'dittowords/web-app'"
}Body
application/json
Minimum array length:
1Example:
[
{
"name": "Web App",
"developerId": "web-app",
"githubRepo": "dittowords/web-app"
},
{ "name": "Mobile App" }
]
Response
Returns the created bases
Example:
[
{
"name": "Web App",
"id": "web-app",
"githubConnection": {
"repoId": 123456789,
"owner": "dittowords",
"repo": "web-app"
},
"scan": {
"id": "6a1f3c9e2b7d4e0012a8f5c3",
"url": "https://app.dittowords.com/scan/6a1f3c9e2b7d4e0012a8f5c3"
}
},
{
"name": "Mobile App",
"id": "mobile-app",
"githubConnection": null,
"scan": null
}
]