Needs
Needs are Content your Cerkl users (the people creating Content) can use to request things from your Subscribers. The
quantity of whatever is needed (e.g. participants, donations, etc.) and the need_by_date_utc
can be specified to
be more specific about what is being requested.
Adding Needs
To add Needs, POST
to the /need
endpoint:
$ curl --request POST 'api.cerkl.com/v3/need' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--data-raw '{
"template": {
"version": "3.0",
"data": [
{
"author": {
"id": <integer>
},
"title": "string",
"summary": "string",
"body": "string",
"more_button_text": "string",
"image_url": "string",
"categories": [
{
"id": <integer>,
"self": "string"
}
],
"external_id": "string",
"priority": {
"id": <integer>,
"self": "string"
},
"priority_until_date_utc": "string",
"publish_date_utc": "string",
"private": <bool>,
"segments": [
{
"id": <integer>,
"self": "string"
}
],
"exclusive_to_segment": <bool>,
"available_in_aptly": <bool>,
"enable_comments": <bool>,
"enable_link_tracking": <bool>,
"need_quantity": 0,
"need_by_date_utc": "string",
"status": {
"id": <integer>,
"self": "string"
},
"self": "string"
}
]
}
}'
Retrieving Needs
Needs are pieces of Content, and can be retrieved using the GET
method on the /content
or /content/{id}
endpoints
(depending on whether you need all Content or just the specific Need Content).
Updating Needs
To update an existing Need, utilize the PUT
method on the /need/{id}
endpoint, constructing your URL with the id
of the existing Need. If your Need’s ID is 12345
, that looks like this:
$ curl --request PUT 'api.cerkl.com/v3/need/12345' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--data-raw '{
"template": {
"version": "string",
"data": [
{
"id": <integer>,
"author": {
"id": <integer>,
"self": "string"
},
"title": "string",
"summary": "string",
"body": "string",
"more_button_text": "string",
"image_url": "string",
"categories": [
{
"id": <integer>,
"self": "string"
}
],
"external_id": "string",
"priority": {
"id": <integer>,
"self": "string"
},
"priority_until_date_utc": "string",
"private": <bool>,
"segments": [
{
"id": <integer>,
"self": "string"
}
],
"exclusive_to_segment": <bool>,
"available_in_aptly": <bool>,
"enable_comments": <bool>,
"enable_link_tracking": <bool>,
"external_url": "string",
"status": {
"id": <integer>,
"self": "string"
},
"self": "string"
}
]
}
}'
Deleting Needs
To delete an Need, you just need to make a DELETE
request to the need/{id}
endpoint using the id
corresponding
to your Need. If our Need id
is still 12345
as it was above, that looks like this:
$ curl --location --request DELETE 'api.cerkl.com/v3/need/12345' \
--header 'Authorization: Bearer {ACCESS_TOKEN}'