Update text items from base
curl --request POST \
--url https://api.dittowords.com/v2/projects/{projectId}/updateFromBase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"textItemIds": [
"welcome-header",
"welcome-subheader"
]
}
'import requests
url = "https://api.dittowords.com/v2/projects/{projectId}/updateFromBase"
payload = { "textItemIds": ["welcome-header", "welcome-subheader"] }
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({textItemIds: ['welcome-header', 'welcome-subheader']})
};
fetch('https://api.dittowords.com/v2/projects/{projectId}/updateFromBase', 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/projects/{projectId}/updateFromBase",
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([
'textItemIds' => [
'welcome-header',
'welcome-subheader'
]
]),
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/projects/{projectId}/updateFromBase"
payload := strings.NewReader("{\n \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\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/projects/{projectId}/updateFromBase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/projects/{projectId}/updateFromBase")
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 \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"updated": [
"welcome-header"
],
"skipped": [
{
"textItemId": "welcome-subheader",
"reason": "modified"
}
]
}{
"message": "1 text item with developer ID welcome-header not found in project my-project"
}Projects
Update text items from base
Updates a project’s text items to their base text item’s version.
Each text item must be Outdated (only the base has changed) or in Conflict (both the project and the base have changed). Updating a text item in Conflict discards the project’s changes to it. Text items in any other state are skipped rather than failing the request; the response lists each one with the reason.
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
/
projects
/
{projectId}
/
updateFromBase
Update text items from base
curl --request POST \
--url https://api.dittowords.com/v2/projects/{projectId}/updateFromBase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"textItemIds": [
"welcome-header",
"welcome-subheader"
]
}
'import requests
url = "https://api.dittowords.com/v2/projects/{projectId}/updateFromBase"
payload = { "textItemIds": ["welcome-header", "welcome-subheader"] }
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({textItemIds: ['welcome-header', 'welcome-subheader']})
};
fetch('https://api.dittowords.com/v2/projects/{projectId}/updateFromBase', 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/projects/{projectId}/updateFromBase",
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([
'textItemIds' => [
'welcome-header',
'welcome-subheader'
]
]),
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/projects/{projectId}/updateFromBase"
payload := strings.NewReader("{\n \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\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/projects/{projectId}/updateFromBase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/projects/{projectId}/updateFromBase")
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 \"textItemIds\": [\n \"welcome-header\",\n \"welcome-subheader\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"updated": [
"welcome-header"
],
"skipped": [
{
"textItemId": "welcome-subheader",
"reason": "modified"
}
]
}{
"message": "1 text item with developer ID welcome-header not found in project my-project"
}Authorizations
Path Parameters
The Developer ID of the project the text items are in
Body
application/json
Developer IDs of the project text items to update to their base text item's version. Each one must be Outdated or in Conflict; any other text item is skipped.
Minimum array length:
1