Skip to main content

Endpoints

  • service status: https://generator.geneea.com/status

    curl -v https://generator.geneea.com/status
  • template validation: https://generator.geneea.com/validate

    curl https://generator.geneea.com/validate \
    -H 'Authorization: Basic ********************' \
    -H 'Content-Type: application/json' \
    --data '{"templates": [ {"id": "1", "name": "test", "body": "Hello"} ], "data": {} }'

    # Replace ******************** with base64-encoded username:password
    # On Windows, use \" instead of " and " instead of '
  • generation: https://generator.geneea.com/generate

    curl https://generator.geneea.com/generate \
    -H 'Authorization: Basic ********************' \
    -H 'Content-Type: application/json' \
    --data '{"templates": [ {"id": "1", "name": "test", "body": "Hello"} ], "data": {} }'

    # Replace ******************** with base64-encoded username:password
    # On Windows, use \" instead of " and " instead of '

Generation

The following code snippets show how to generate

curl https://generator.geneea.com/generate -H "Authorization: Basic ********************"  -H 'Content-Type: application/json'  --data @example.request.json

# Replace **\*\*\*\***\*\*\*\***\*\*\*\*** with base64-encoded username:password

</TabItem>
<TabItem value="cURL" label="cURL">
``` bash
curl https://generator.geneea.com/generate -H "Authorization: Basic ********************" -H 'Content-Type: application/json' --data @example.request.json

# Replace **\*\*\*\***\*\*\*\***\*\*\*\*** with base64-encoded username:password

# On Windows, use \" instead of " and " instead of '

As example.request.json, you can use the following file containing the template and data:

{
"templates": [
{
"id": "tmpl-1",
"name": "testing template",
"body": "Do 2. kola v {{district|name|morph('Case=Loc')}} postoupili {{candidates[0]|name}} a {{candidates[1]|name}}."
}
],
"data": {
"year": 2018,
"district": { "name": "Opava" },
"candidates": [
{ "name": "Herbert Pavera (TOP 09)", "votesPct": 36.27 },
{ "name": "Simona Horáková (ANO)", "votesPct": 21.54 },
{ "name": "Vladimír Tancík (NK)", "votesPct": 12.14 }
]
}
}
Coming soon.

The result of the generation is:

{
"id": "tmpl-1-2021-04-23T15:33:29",
"article": "Do 2. kola v Opavě postoupili Herbert Pavera (TOP 09) a Simona Horáková (ANO).",
"messages": []
}