Create text items from a base
curl --request POST \
--url https://api.dittowords.com/v2/textItems/fromBase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "my-project",
"baseTextItemIds": [
"welcome-header",
"welcome-subheader"
],
"newBlockName": "Onboarding"
}
'import requests
url = "https://api.dittowords.com/v2/textItems/fromBase"
payload = {
"projectId": "my-project",
"baseTextItemIds": ["welcome-header", "welcome-subheader"],
"newBlockName": "Onboarding"
}
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({
projectId: 'my-project',
baseTextItemIds: ['welcome-header', 'welcome-subheader'],
newBlockName: 'Onboarding'
})
};
fetch('https://api.dittowords.com/v2/textItems/fromBase', 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/textItems/fromBase",
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([
'projectId' => 'my-project',
'baseTextItemIds' => [
'welcome-header',
'welcome-subheader'
],
'newBlockName' => 'Onboarding'
]),
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/textItems/fromBase"
payload := strings.NewReader("{\n \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\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/textItems/fromBase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/textItems/fromBase")
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 \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "Text items already exist in the target project for base text items: welcome-header"
}{
"message": "Text items not found in the connected base: welcome-header"
}Text Items
Create text items from a base
Copies text items from a base into a project connected to that base.
The target project must already be connected to a base, and every ID in baseTextItemIds must belong to that base. Each base text item can only be copied into a project once; the request fails if any of them is already in the project.
By default the new text items will be placed in the project root. Pass blockId to place them in an existing block, or newBlockName to create a block for them. The two are mutually exclusive.
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
/
textItems
/
fromBase
Create text items from a base
curl --request POST \
--url https://api.dittowords.com/v2/textItems/fromBase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "my-project",
"baseTextItemIds": [
"welcome-header",
"welcome-subheader"
],
"newBlockName": "Onboarding"
}
'import requests
url = "https://api.dittowords.com/v2/textItems/fromBase"
payload = {
"projectId": "my-project",
"baseTextItemIds": ["welcome-header", "welcome-subheader"],
"newBlockName": "Onboarding"
}
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({
projectId: 'my-project',
baseTextItemIds: ['welcome-header', 'welcome-subheader'],
newBlockName: 'Onboarding'
})
};
fetch('https://api.dittowords.com/v2/textItems/fromBase', 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/textItems/fromBase",
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([
'projectId' => 'my-project',
'baseTextItemIds' => [
'welcome-header',
'welcome-subheader'
],
'newBlockName' => 'Onboarding'
]),
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/textItems/fromBase"
payload := strings.NewReader("{\n \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\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/textItems/fromBase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/textItems/fromBase")
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 \"projectId\": \"my-project\",\n \"baseTextItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ],\n \"newBlockName\": \"Onboarding\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "Text items already exist in the target project for base text items: welcome-header"
}{
"message": "Text items not found in the connected base: welcome-header"
}Body
application/json