Create Push task

Create Push task

POST https://api.ocamba.com/v0/hood/push-tasks
Creates a new Push task object

Request schema

body

Response schemas

curl -X POST \
 "https://api.ocamba.com/v0/hood/push-tasks" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example task name",
  "status": 0,
  "start_time": "2021-12-28 09:16:33",
  "end_time": "2021-12-28 11:00:00",
  "frequency": 3600,
  "cron": "0 0 * * *",
  "ttl": 2400,
  "user_time_zone": 1,
  "quiet_time": {},
  "custom_data": null,
  "targeting": {},
  "message": {},
  "adex": {}
}'
const url = 'https://api.ocamba.com/v0/hood/push-tasks';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Example task name",
      "status": 0,
      "start_time": "2021-12-28 09:16:33",
      "end_time": "2021-12-28 11:00:00",
      "frequency": 3600,
      "cron": "0 0 * * *",
      "ttl": 2400,
      "user_time_zone": 1,
      "quiet_time": {},
      "custom_data": null,
      "targeting": {},
      "message": {},
      "adex": {}
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v0/hood/push-tasks");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Example task name",
    "status" => 0,
    "start_time" => "2021-12-28 09:16:33",
    "end_time" => "2021-12-28 11:00:00",
    "frequency" => 3600,
    "cron" => "0 0 * * *",
    "ttl" => 2400,
    "user_time_zone" => 1,
    "quiet_time" => [],
    "custom_data" => null,
    "targeting" => [],
    "message" => [],
    "adex" => []
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

201 Created

{
  "id": "1057"
}

400 Bad Request

500 Internal Server Error

Responses

Warning
Push task without start_time can not be active.
Note
Push task start_time can not be in the past.
push task end_time can not be set to date before start_time.
To repeat task on equal time intervals you can use frequency field. In order to have more control over repeating intervals you can use cron field. Check request examples for more info.