Skip to main content

Creating an entity

Submitting the request#

In order to create a todo, we simply send a POST request to the collections path with the body parameters that correspond to the fields the entity will have.

Creating a todo
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({"title":"Create an app using Architect"});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw
};
fetch("https://your_app_id.essentialz.cloud/api/todos", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Example response
{
"title": "Create an app using Architect",
"id": "87af6b75-485e-4262-8031-0ee2784213b8",
"created_at": "1623835509.4978082",
"updated_at": "1623835509.4978082"
}

Effects#

Creating an entity dispatches an event {{entity_name}}_created to which you can subscribe with {insert link to webhook subscribe}