Skip to main content
POST
/
rules
/
matches
Match rule text
curl --request POST \
  --url https://api.beyondwords.io/v1/rules/matches \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "project": {
    "id": 2
  },
  "segments": {
    "uuid": "<string>",
    "text": "<string>",
    "language": {
      "code": "<string>"
    },
    "voice": {
      "id": 2
    }
  },
  "content": {
    "id": "<string>"
  },
  "rules": [
    2
  ]
}
'
import requests

url = "https://api.beyondwords.io/v1/rules/matches"

payload = {
"project": { "id": 2 },
"segments": {
"uuid": "<string>",
"text": "<string>",
"language": { "code": "<string>" },
"voice": { "id": 2 }
},
"content": { "id": "<string>" },
"rules": [2]
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project: {id: 2},
segments: {
uuid: '<string>',
text: '<string>',
language: {code: '<string>'},
voice: {id: 2}
},
content: {id: '<string>'},
rules: [2]
})
};

fetch('https://api.beyondwords.io/v1/rules/matches', 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.beyondwords.io/v1/rules/matches",
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([
'project' => [
'id' => 2
],
'segments' => [
'uuid' => '<string>',
'text' => '<string>',
'language' => [
'code' => '<string>'
],
'voice' => [
'id' => 2
]
],
'content' => [
'id' => '<string>'
],
'rules' => [
2
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);

$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.beyondwords.io/v1/rules/matches"

payload := strings.NewReader("{\n \"project\": {\n \"id\": 2\n },\n \"segments\": {\n \"uuid\": \"<string>\",\n \"text\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"voice\": {\n \"id\": 2\n }\n },\n \"content\": {\n \"id\": \"<string>\"\n },\n \"rules\": [\n 2\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Api-Key", "<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.beyondwords.io/v1/rules/matches")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project\": {\n \"id\": 2\n },\n \"segments\": {\n \"uuid\": \"<string>\",\n \"text\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"voice\": {\n \"id\": 2\n }\n },\n \"content\": {\n \"id\": \"<string>\"\n },\n \"rules\": [\n 2\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.beyondwords.io/v1/rules/matches")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project\": {\n \"id\": 2\n },\n \"segments\": {\n \"uuid\": \"<string>\",\n \"text\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"voice\": {\n \"id\": 2\n }\n },\n \"content\": {\n \"id\": \"<string>\"\n },\n \"rules\": [\n 2\n ]\n}"

response = http.request(request)
puts response.read_body
[
  {
    "uuid": "<string>",
    "selected": [
      {
        "rule": {
          "id": 123,
          "project": {
            "id": 123,
            "name": "<string>"
          },
          "content": {
            "id": "<string>",
            "title": "<string>"
          },
          "language": {
            "code": "<string>",
            "name": "<string>",
            "accent": "<string>"
          },
          "preview_voice": {
            "id": 123,
            "name": "<string>"
          },
          "preview_audio": {
            "url": "<string>",
            "content_type": "<string>",
            "duration": 123
          },
          "key": "<string>",
          "value": "<string>",
          "magic_ipa_used": true,
          "created": "<string>",
          "updated": "<string>"
        },
        "start_index": 123,
        "end_index": 123
      }
    ],
    "discarded": [
      {
        "rule": {
          "id": 123,
          "project": {
            "id": 123,
            "name": "<string>"
          },
          "content": {
            "id": "<string>",
            "title": "<string>"
          },
          "language": {
            "code": "<string>",
            "name": "<string>",
            "accent": "<string>"
          },
          "preview_voice": {
            "id": 123,
            "name": "<string>"
          },
          "preview_audio": {
            "url": "<string>",
            "content_type": "<string>",
            "duration": 123
          },
          "key": "<string>",
          "value": "<string>",
          "magic_ipa_used": true,
          "created": "<string>",
          "updated": "<string>"
        },
        "start_index": 123,
        "end_index": 123,
        "discard_reason": "<string>"
      }
    ]
  }
]

Authorizations

X-Api-Key
string
header
required

Body

application/json
project
object
required
segments
object
required
content
object
rules
integer[]

A list of rule IDs to limit the evaluation to (optional)

Required range: x >= 1

Response

200 - application/json

successful

uuid
string
selected
object[]
discarded
object[]