Databases
Get list of records
REQUEST (Javascript)
fetch("https://www.includecore.com/api/projects/PROJECT_ID/databases/DATABASE_ID-DATABASE_NAME", {
method: "GET",
headers: { "Accept": "application/json" }
})
.then(response => response.json())
.then(data => { /* YOUR LOGIC HERE */ })
.catch(error => console.error(error));
RESPONSE
{
"data": [
{
"id": 9166,
"title": "My first blog post",
"content": "<p style=\"text-align:center;\">My first blog post</p>",
"cover": "COVER_URL"
},
{
"id": 9167,
"title": "My second blog post",
"content": "<p style=\"text-align:center;\">My second blog post</p>",
"cover": "COVER_URL"
}
],
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 10,
"next_page_url": null,
"prev_page_url": null,
"count_elements": 1
}
}
Get a single records
REQUEST (Javascript)
fetch("https://www.includecore.com/api/projects/PROJECT_ID/databases/DATABASE_ID-DATABASE_NAME/entries/ENTRY_ID", {
method: "GET",
headers: { "Accept": "application/json" }
})
.then(response => response.json())
.then(data => { /* YOUR LOGIC HERE */ })
.catch(error => console.error(error));
RESPONSE
{
"id": 9166,
"title": "My first blog post",
"content": "<p style=\"text-align:center;\">My first blog post</p>",
"cover": "COVER_URL"
}
Create an entry
REQUEST (Javascript)
const requestBody = new FormData();
requestBody.append("title", "YOUR_TITLE");
requestBody.append("content", "YOUR_HTML");
requestBody.append("cover", "YOUR_FILE_IMAGE");
fetch("https://www.includecore.com/api/projects/PROJECT_ID/databases/DATABASE_ID-DATABASE_NAME", {
method: "POST",
headers: { "Accept": "application/json" },
body: requestBody
});
RESPONSE
{
"id": 9187,
"title": "YOUR_TITLE",
"content": "YOUR_HTML",
"cover": "YOUR_FILE_IMAGE_URL"
}
Update an entry
REQUEST (Javascript)
const requestBody = new FormData();
requestBody.append("_method", "PUT");
requestBody.append("title", "NEW_TITLE");
requestBody.append("content", "NEW_HTML_CONTENT");
requestBody.append("cover", "NEW_FILE_IMAGE");
fetch("https://www.includecore.com/api/projects/PROJECT_ID/databases/DATABASE_ID-DATABASE_NAME/entries/ENTRY_ID", {
method: "POST",
headers: { "Accept": "application/json" },
body: requestBody
});
RESPONSE
{
"id": 9187,
"title": "NEW_TITLE",
"content": "NEW_HTML_CONTENT",
"cover": "NEW_FILE_IMAGE_URL"
}
Delete an entry
REQUEST (Javascript)
const requestBody = new FormData();
requestBody.append("_method", "DELETE");
fetch("https://www.includecore.com/api/projects/PROJECT_ID/databases/DATABASE_ID-DATABASE_NAME/entries/ENTRY_ID", {
method: "POST",
headers: { "Accept": "application/json" },
body: requestBody
});
RESPONSE
Empty response body, status code 204 is returned if successful.
Last updated