Skip to main content
POST
/
textItems
Create text items
curl --request POST \
  --url https://api.dittowords.com/v2/textItems \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projectId": "project-id",
  "textItems": [
    {
      "text": "Hello world"
    },
    {
      "developerId": "custom-dev-id",
      "text": "Custom ID example",
      "notes": "Shown on the welcome screen",
      "characterLimit": 80
    },
    {
      "text": "{{count}} items in your cart",
      "variables": [
        "count"
      ],
      "plurals": [
        {
          "form": "one",
          "text": "{{count}} item in your cart"
        },
        {
          "form": "other",
          "text": "{{count}} items in your cart"
        }
      ]
    },
    {
      "text": "Hello world",
      "developerId": "localized-greeting",
      "variants": [
        {
          "variantId": "french",
          "text": "Bonjour le monde"
        }
      ]
    }
  ]
}
'
import requests

url = "https://api.dittowords.com/v2/textItems"

payload = {
"projectId": "project-id",
"textItems": [
{ "text": "Hello world" },
{
"developerId": "custom-dev-id",
"text": "Custom ID example",
"notes": "Shown on the welcome screen",
"characterLimit": 80
},
{
"text": "{{count}} items in your cart",
"variables": ["count"],
"plurals": [
{
"form": "one",
"text": "{{count}} item in your cart"
},
{
"form": "other",
"text": "{{count}} items in your cart"
}
]
},
{
"text": "Hello world",
"developerId": "localized-greeting",
"variants": [
{
"variantId": "french",
"text": "Bonjour le monde"
}
]
}
]
}
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: 'project-id',
textItems: [
{text: 'Hello world'},
{
developerId: 'custom-dev-id',
text: 'Custom ID example',
notes: 'Shown on the welcome screen',
characterLimit: 80
},
{
text: '{{count}} items in your cart',
variables: ['count'],
plurals: [
{form: 'one', text: '{{count}} item in your cart'},
{form: 'other', text: '{{count}} items in your cart'}
]
},
{
text: 'Hello world',
developerId: 'localized-greeting',
variants: [{variantId: 'french', text: 'Bonjour le monde'}]
}
]
})
};

fetch('https://api.dittowords.com/v2/textItems', 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",
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' => 'project-id',
'textItems' => [
[
'text' => 'Hello world'
],
[
'developerId' => 'custom-dev-id',
'text' => 'Custom ID example',
'notes' => 'Shown on the welcome screen',
'characterLimit' => 80
],
[
'text' => '{{count}} items in your cart',
'variables' => [
'count'
],
'plurals' => [
[
'form' => 'one',
'text' => '{{count}} item in your cart'
],
[
'form' => 'other',
'text' => '{{count}} items in your cart'
]
]
],
[
'text' => 'Hello world',
'developerId' => 'localized-greeting',
'variants' => [
[
'variantId' => 'french',
'text' => 'Bonjour le monde'
]
]
]
]
]),
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"

payload := strings.NewReader("{\n \"projectId\": \"project-id\",\n \"textItems\": [\n {\n \"text\": \"Hello world\"\n },\n {\n \"developerId\": \"custom-dev-id\",\n \"text\": \"Custom ID example\",\n \"notes\": \"Shown on the welcome screen\",\n \"characterLimit\": 80\n },\n {\n \"text\": \"{{count}} items in your cart\",\n \"variables\": [\n \"count\"\n ],\n \"plurals\": [\n {\n \"form\": \"one\",\n \"text\": \"{{count}} item in your cart\"\n },\n {\n \"form\": \"other\",\n \"text\": \"{{count}} items in your cart\"\n }\n ]\n },\n {\n \"text\": \"Hello world\",\n \"developerId\": \"localized-greeting\",\n \"variants\": [\n {\n \"variantId\": \"french\",\n \"text\": \"Bonjour le monde\"\n }\n ]\n }\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/textItems")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"project-id\",\n \"textItems\": [\n {\n \"text\": \"Hello world\"\n },\n {\n \"developerId\": \"custom-dev-id\",\n \"text\": \"Custom ID example\",\n \"notes\": \"Shown on the welcome screen\",\n \"characterLimit\": 80\n },\n {\n \"text\": \"{{count}} items in your cart\",\n \"variables\": [\n \"count\"\n ],\n \"plurals\": [\n {\n \"form\": \"one\",\n \"text\": \"{{count}} item in your cart\"\n },\n {\n \"form\": \"other\",\n \"text\": \"{{count}} items in your cart\"\n }\n ]\n },\n {\n \"text\": \"Hello world\",\n \"developerId\": \"localized-greeting\",\n \"variants\": [\n {\n \"variantId\": \"french\",\n \"text\": \"Bonjour le monde\"\n }\n ]\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.dittowords.com/v2/textItems")

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\": \"project-id\",\n \"textItems\": [\n {\n \"text\": \"Hello world\"\n },\n {\n \"developerId\": \"custom-dev-id\",\n \"text\": \"Custom ID example\",\n \"notes\": \"Shown on the welcome screen\",\n \"characterLimit\": 80\n },\n {\n \"text\": \"{{count}} items in your cart\",\n \"variables\": [\n \"count\"\n ],\n \"plurals\": [\n {\n \"form\": \"one\",\n \"text\": \"{{count}} item in your cart\"\n },\n {\n \"form\": \"other\",\n \"text\": \"{{count}} items in your cart\"\n }\n ]\n },\n {\n \"text\": \"Hello world\",\n \"developerId\": \"localized-greeting\",\n \"variants\": [\n {\n \"variantId\": \"french\",\n \"text\": \"Bonjour le monde\"\n }\n ]\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "developerIds": [
    "hello-world",
    "custom-dev-id"
  ]
}

Authorizations

Authorization
string
header
required

Body

application/json
projectId
string
required

Developer ID of the project the new text items will be added to

textItems
object[]
required

Array of new text items to create

Response

200 - application/json

Returns the developer IDs of the created text items

developerIds
string[]
required

Array of developer IDs for the created text items