Create project from template
POST:
api.vev.design/project/create-from-template/:template-id
Headers:​
Name/type | Description |
---|---|
x-vev-key | Your API key |
Content-Type | application/json |
Params:​
Name/type | Description |
---|---|
workspaceKey | string |
Body:​
Name/type | Description |
---|---|
id string | Your unique ID for the project (optional) |
title string | The title of your project (optional) |
description string | The description for your project (optional) |
pages array | And object of page |
tags array | And array of strings to set the tags for the project |
pinned array | An object of pinned content matching the schema for your template.See updating pinned content for an example. |
Page:​
Name/type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id string | Your unique ID for the page (optional) | ||||||||||
title string | The title of your project (optional) | ||||||||||
description string | The description for your project (optional) | ||||||||||
path string | The path of the page | ||||||||||
status number | The status of the page
| ||||||||||
data array | An array of sections matching the schema for your template. | ||||||||||
pinned array | An array of ids of the pinned content that should be visible on this page. |
Response:​
Name/type | Description |
---|---|
body json | A list of all created IDs |
Example
This will create a project from a template populated with content.
The structure of your template data will be specific to your template, but it will always contain an array of sections. You should also always provide your own ID to be able to update.
Example template data (this will be different for every template):
[
{
"id": "your-id-1",
"_type": "header",
"text": "This is a cat",
"image": "https://unsplash.com/photos/gKXKBY-C-Dk"
},
{
"id": "your-id-2",
"_type": "imageAndText",
"--background-color": "#222",
"title": "This is a dog",
"image": "https://unsplash.com/photos/N04FIfHhv_k"
}
]
Request:
curl -X POST \
-H "x-vev-key: [your-key]" \
-H "Content-Type: application/json" \
-d '{"id":"my-project-id","title":"Cats","pages":[{"id":"pageId","title":"cat","data":'[{"id":"my-id-1","type":"header","text":"This is a cat","image":"https://unsplash.com/photos/gKXKBY-C-Dk"},{"id":"my-id-2","_type":"imageAndText","--background-color":"#222","title":"This is a dog","image":"https://unsplash.com/photos/N04FIfHhv_k"}]'}' \
https://api.vev.design/project/create-from-template/yJCahB0DHN
info
Add your "id"
to the project, page and section to be able to update.
Pinned content
If you have added pinned content to your schema you set the visibility for each individual page by using the pinned array:
{
"id": "project-id",
"title": "My new project",
"pages": [{
"id": "page-id",
"pinned": ["<your_pinned_id>"]
"data": [{
"id": "section-id-1",
"_type": "headerSection",
"text": "My page!",
}]
}]
},
Updating pinned content​
Updating pinned content
{
"id": "project-id",
"title": "My new project",
"pinned": {
"<your_pinned_id>": "https://unsplash.com/photos/gKXKBY-C-Dk"
}
}