API(for developers)
All templates has GET/POST APIs. If you pass your data via API, you can view templates filled with your data.
Template
URL and mode
All templates has two types of URL. Both URL has same APIs.
1. Basic template URL(Editable mode)
URL: https://10plate.io/t/[slug]
Sample: https://10plate.io/t/BDrLdxrRJVW
This is basic template page URL.
Users can edit template after filled with data via API.
2. Fixed(NOT editable) mode
URL: https://10plate.io/d/t/[slug]
Sample: https://10plate.io/d/t/BDrLdxrRJVW
Insert /d
to basic template URL, then template can't be editable.
This URL is recommended for using with API.
API
Pass parameters to templates
Parameter name is same as defined label in template.
If template like this:
hello,{{foo}}
hello,{{bar}}
hello,{{baz}}
POST/GET your data like:
foo=hogehoge&bar=fugafuga&baz=piyopiyo
Then rendered:
hello,hogehoge
hello,fugafuga
hello,piyopiyo
Samples:
Editable: https://10plate.io/t/6GyY67kE9Wk?foo=hogehoge&bar=fugafuga&baz=piyopiyo
Fixed: https://10plate.io/d/t/6GyY67kE9Wk?foo=hogehoge&bar=fugafuga&baz=piyopiyo
JSON API
You can also use JSON.
Create JSON data, and pass JSON string as json
parameter. Like:
{"foo":"hogehoge","bar":"fugafuga","baz":"piyopiyo"}
Samples:
Editable: https://10plate.io/t/6GyY67kE9Wk?json=%7B%22foo%22%3A%22hogehoge%22%2C%22bar%22%3A%22fugafuga%22%2C%22baz%22%3A%22piyopiyo%22%7D
Fixed: https://10plate.io/d/t/6GyY67kE9Wk?json=%7B%22foo%22%3A%22hogehoge%22%2C%22bar%22%3A%22fugafuga%22%2C%22baz%22%3A%22piyopiyo%22%7D
Generate Multiple pages at once
With JSON, you can pass your datas as array, and get multiple documents at once.
Pass your multiple data as array like:
[
{"foo":"hogehoge","bar":"fugafuga","baz":"piyopiyo"},
{"foo":"ほげほげ","bar":"ふがふが","baz":"ぴよぴよ"}
]
Renderd two documents like:
hello,hogehoge
hello,fugafuga
hello,piyopiyo
------
hello,ほげほげ
hello,ふがふが
hello,ぴよぴよ
Samples:
Editable: https://10plate.io/t/6GyY67kE9Wk?json=%5B%7B%22foo%22%3A%22hogehoge%22%2C%22bar%22%3A%22fugafuga%22%2C%22baz%22%3A%22piyopiyo%22%7D%2C%7B%22foo%22%3A%22%E3%81%BB%E3%81%92%E3%81%BB%E3%81%92%22%2C%22bar%22%3A%22%E3%81%B5%E3%81%8C%E3%81%B5%E3%81%8C%22%2C%22baz%22%3A%22%E3%81%B4%E3%82%88%E3%81%B4%E3%82%88%22%7D%5D
Fixed: https://10plate.io/d/t/6GyY67kE9Wk?json=%5B%7B%22foo%22%3A%22hogehoge%22%2C%22bar%22%3A%22fugafuga%22%2C%22baz%22%3A%22piyopiyo%22%7D%2C%7B%22foo%22%3A%22%E3%81%BB%E3%81%92%E3%81%BB%E3%81%92%22%2C%22bar%22%3A%22%E3%81%B5%E3%81%8C%E3%81%B5%E3%81%8C%22%2C%22baz%22%3A%22%E3%81%B4%E3%82%88%E3%81%B4%E3%82%88%22%7D%5D
Template meta
API for getting template meta information like input label and schema.
URL
https://10plate.io/t/[slug]/meta
output
{
"last_revision_no": [Latest revision number],
"schema": [
{
"alt_label": "[alternative label]",
"default_value": "[default value]",
"label": "[label for field]",
"type": "[type of field]"
},
{
"alt_label": "[alternative label]",
"choices": [
{
"label": "[label for choice]",
"value": "[value for choice]"
},
{
"label": "[label for choice]",
"value": "[value for choice]"
}...
],
"default_value": "[default value]",
"label": "[label for field]",
"type": "[type of field]"
}...
]
}
Sample:
template:https://10plate.io/t/g5eX7Vz106z
meta:https://10plate.io/t/g5eX7Vz106z/meta