Creating people
This endpoint creates a new person
HTTP Request
POST https://api.lunatask.app/v1/people
Body Parameters
Parameter | Description |
---|---|
first_name | A person's first name |
last_name | A person's last name |
relationship_strength | One of family , intimate-friends , close-friends , casual-friends , acquaintances , business-contacts , or almost-strangers (optional, casual-friends will be used if not provided) |
source | Identification of external system where the note is coming from (optional, e.g. "salesforce" ) |
source_id | The ID of the record in the external system (optional, e.g. "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" ) |
When creating a person, given there's already an existing person with the same source
/source_id
, the endpoint will return 204 No Content
without creating a duplicate.
Additionally, you can persist value for a few selected fields while creating people:
Parameter | Description |
---|---|
email | A person's email address |
birthday | A person's birthday (ISO-8601 formatted date) |
phone | A person's phone number |
Custom fields for email, birthday, or phone number first have to be defined in the app. Otherwise the API will return 422 error code.
Example in Ruby
require 'rest-client'
access_token = 'xxx'
payload = {
first_name: 'John',
last_name: 'Doe',
relationship_strength: 'business-contacts',
source: 'salesforce',
source_id: '352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7',
}
RestClient.post('https://api.lunatask.app/v1/people', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' })
Response
The above command returns JSON structured like this:
{
"person": {
"id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e",
"relationship_strength": "business-contacts",
"sources": [
{
"source": "salesforce",
"source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7"
}
],
"created_at": "2021-01-10T10:39:25Z",
"updated_at": "2021-01-10T10:39:25Z"
}
}
When the number of people on Free plan reaches its limit, this API will respond with a 402 HTTP status code.