POST
/objects/{objectSlug}/recordsThe body has one property, values, keyed by field key. See Field values.
curl --fail-with-body "$JEMERO_URL/objects/people/records" \
-H "Authorization: Bearer $JEMERO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"values": {
"name": "Ada Lovelace",
"email": "[email protected]",
"jobTitle": "Analyst"
}
}'const response = await fetch(`${process.env.JEMERO_URL}/objects/people/records`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.JEMERO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
values: { name: 'Ada Lovelace', email: '[email protected]', jobTitle: 'Analyst' },
}),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const { record } = await response.json();
console.log(record.id);import os
import requests
response = requests.post(
f"{os.environ['JEMERO_URL']}/objects/people/records",
headers={"Authorization": f"Bearer {os.environ['JEMERO_API_KEY']}"},
json={
"values": {
"name": "Ada Lovelace",
"email": "[email protected]",
"jobTitle": "Analyst",
}
},
timeout=30,
)
response.raise_for_status()
print(response.json()["record"]["id"])The answer is 201 Created with { "record": … }, in the same shape as Get a record.
Errors#
| Status | Cause |
|---|---|
400 | A value is invalid, a field is unknown or read-only, a required field is missing, or a linked record doesn't exist. |
403 | Your role can't add records to this object, or can't set one of the fields. |
404 Object not found | No object with that slug. |
409 | Another record already has the value of a unique field. |
{
"error": "Validation Error",
"issues": [
{ "path": "nickname", "message": "Unknown field" },
{ "path": "email", "message": "Enter a valid email" }
],
"status": 400
}{
"error": "Another record already has this email",
"issues": [{ "path": "email", "message": "Another record already has this email" }],
"status": 409
}