Create a style guide
curl --request POST \
--url https://api.dittowords.com/v2/styleguides \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Acme Inc.",
"description": "Voice and tone for Acme Inc. product text.",
"sections": [
{
"sectionId": "foundations",
"name": "Foundations",
"kind": "rules"
},
{
"sectionId": "word-list",
"name": "Word List",
"kind": "wordlist"
}
]
}
'import requests
url = "https://api.dittowords.com/v2/styleguides"
payload = {
"name": "Acme Inc.",
"description": "Voice and tone for Acme Inc. product text.",
"sections": [
{
"sectionId": "foundations",
"name": "Foundations",
"kind": "rules"
},
{
"sectionId": "word-list",
"name": "Word List",
"kind": "wordlist"
}
]
}
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: 'Acme Inc.',
description: 'Voice and tone for Acme Inc. product text.',
sections: [
{sectionId: 'foundations', name: 'Foundations', kind: 'rules'},
{sectionId: 'word-list', name: 'Word List', kind: 'wordlist'}
]
})
};
fetch('https://api.dittowords.com/v2/styleguides', 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/styleguides",
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' => 'Acme Inc.',
'description' => 'Voice and tone for Acme Inc. product text.',
'sections' => [
[
'sectionId' => 'foundations',
'name' => 'Foundations',
'kind' => 'rules'
],
[
'sectionId' => 'word-list',
'name' => 'Word List',
'kind' => 'wordlist'
]
]
]),
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/styleguides"
payload := strings.NewReader("{\n \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\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/styleguides")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/styleguides")
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 \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "acme-inc",
"name": "Acme Inc."
}{
"message": "At least one wordlist section is required"
}{
"message": "Variant with developer ID 'french' not found"
}Style guides
Create a style guide
Creates a new style guide in your workspace.
Use POST /styleguides/rules afterward to add rules to a section.
POST
/
styleguides
Create a style guide
curl --request POST \
--url https://api.dittowords.com/v2/styleguides \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Acme Inc.",
"description": "Voice and tone for Acme Inc. product text.",
"sections": [
{
"sectionId": "foundations",
"name": "Foundations",
"kind": "rules"
},
{
"sectionId": "word-list",
"name": "Word List",
"kind": "wordlist"
}
]
}
'import requests
url = "https://api.dittowords.com/v2/styleguides"
payload = {
"name": "Acme Inc.",
"description": "Voice and tone for Acme Inc. product text.",
"sections": [
{
"sectionId": "foundations",
"name": "Foundations",
"kind": "rules"
},
{
"sectionId": "word-list",
"name": "Word List",
"kind": "wordlist"
}
]
}
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: 'Acme Inc.',
description: 'Voice and tone for Acme Inc. product text.',
sections: [
{sectionId: 'foundations', name: 'Foundations', kind: 'rules'},
{sectionId: 'word-list', name: 'Word List', kind: 'wordlist'}
]
})
};
fetch('https://api.dittowords.com/v2/styleguides', 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/styleguides",
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' => 'Acme Inc.',
'description' => 'Voice and tone for Acme Inc. product text.',
'sections' => [
[
'sectionId' => 'foundations',
'name' => 'Foundations',
'kind' => 'rules'
],
[
'sectionId' => 'word-list',
'name' => 'Word List',
'kind' => 'wordlist'
]
]
]),
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/styleguides"
payload := strings.NewReader("{\n \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\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/styleguides")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dittowords.com/v2/styleguides")
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 \"name\": \"Acme Inc.\",\n \"description\": \"Voice and tone for Acme Inc. product text.\",\n \"sections\": [\n {\n \"sectionId\": \"foundations\",\n \"name\": \"Foundations\",\n \"kind\": \"rules\"\n },\n {\n \"sectionId\": \"word-list\",\n \"name\": \"Word List\",\n \"kind\": \"wordlist\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "acme-inc",
"name": "Acme Inc."
}{
"message": "At least one wordlist section is required"
}{
"message": "Variant with developer ID 'french' not found"
}Body
application/json
Developer ID of a variant to scope this style guide to — its rules then apply only to text in that variant. Currently, this is only supported for variants with a locale code. Omit for a style guide that should apply to all text.
Scoping a style guide to a variant is how it's associated with a locale, because a locale in Ditto is a variant's locale code. Use GET /v2/variants to find the variant whose locale code matches the locale you want, rather than inferring it from the variant's name.
Minimum string length:
1