// JavaScript Example: Reading Entities
// Filterable fields:
async function fetchEntityNameEntities() {
const response = await fetch(`https://app.base44.com/api/apps/68723b5ba104e0d7d02289ad/entities/EntityName`, {
headers: {
'api_key': 'cc1bef7574d442fcb07cf24b732b125c', // or use await User.me() to get the API key
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
}
// JavaScript Example: Updating an Entity
// Filterable fields:
async function updateEntityNameEntity(entityId, updateData) {
const response = await fetch(`https://app.base44.com/api/apps/68723b5ba104e0d7d02289ad/entities/EntityName/${entityId}`, {
method: 'PUT',
headers: {
'api_key': 'cc1bef7574d442fcb07cf24b732b125c', // or use await User.me() to get the API key
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
const data = await response.json();
console.log(data);
}