Update a container Modal

Update a container Modal

PATCH https://api.ocamba.com/v1/hood/containers/{container_id}/modals/{id}
Update modal. Updateable fields: status, name, triggers, filters, settings, group, frequency, ab_test_config and messages.

Warning
Finished modals cannot be updated.

Rate limits:

  • Burst: 10/s
  • Steady: 150/m

Path parameters

parameters

Request schema

body

Response schemas

204
No Content
curl -X PATCH \
 "https://api.ocamba.com/v1/hood/containers/{container_id}/modals/{id}" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '"{\n  \"name\": \"updated modal name\",\n  \"status\": \"active\",\n  \"filters\": [\n    {\n      \"variable\": \"5869\",\n      \"op\": \"eq\",\n      \"value\": \"keyword\"\n    }\n  ],\n  \"triggers\": {\n    \"page_load\": true,\n    \"page_view\": true,\n    \"scroll_depth\": {\n      \"horizontal\": {\n        \"percentage\": 100\n      },\n      \"enable_on\": \"window-load\"\n    },\n    \"timer\": 60000,\n    \"custom_event\": {\n        \"event\": \"onload\"\n    }\n  },\n  \"settings\": {\n    \"position\": \"center-center\",\n    \"background_color\": \"blue\",\n    \"height\": 700,\n    \"width\": 500,\n    \"close_cta\": false,\n    \"close_esc\": true,\n    \"close_click\": true,\n    \"close_auto\": 0,\n    \"delay\": 0,\n    \"animation\": \"fade-in\"\n  },\n  \"frequency\": {\n      \"always_show\": true,\n      \"stop_after_interaction\": false\n      \"show_cooldown\": 1000\n  },\n  \"group\": \"group A\"\n}"'
const url = 'https://api.ocamba.com/v1/hood/containers/{container_id}/modals/{id}';
const options = {
  method: 'PATCH',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    "{\n  \"name\": \"updated modal name\",\n  \"status\": \"active\",\n  \"filters\": [\n    {\n      \"variable\": \"5869\",\n      \"op\": \"eq\",\n      \"value\": \"keyword\"\n    }\n  ],\n  \"triggers\": {\n    \"page_load\": true,\n    \"page_view\": true,\n    \"scroll_depth\": {\n      \"horizontal\": {\n        \"percentage\": 100\n      },\n      \"enable_on\": \"window-load\"\n    },\n    \"timer\": 60000,\n    \"custom_event\": {\n        \"event\": \"onload\"\n    }\n  },\n  \"settings\": {\n    \"position\": \"center-center\",\n    \"background_color\": \"blue\",\n    \"height\": 700,\n    \"width\": 500,\n    \"close_cta\": false,\n    \"close_esc\": true,\n    \"close_click\": true,\n    \"close_auto\": 0,\n    \"delay\": 0,\n    \"animation\": \"fade-in\"\n  },\n  \"frequency\": {\n      \"always_show\": true,\n      \"stop_after_interaction\": false\n      \"show_cooldown\": 1000\n  },\n  \"group\": \"group A\"\n}"
  )
};

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/v1/hood/containers/{container_id}/modals/{id}");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  "[\n  \"name\" => \"updated modal name\",\n  \"status\" => \"active\",\n  \"filters\" => [\n    [\n      \"variable\" => \"5869\",\n      \"op\" => \"eq\",\n      \"value\" => \"keyword\"\n    ]\n  ],\n  \"triggers\" => [\n    \"page_load\" => true,\n    \"page_view\" => true,\n    \"scroll_depth\" => [\n      \"horizontal\" => [\n        \"percentage\" => 100\n      ],\n      \"enable_on\" => \"window-load\"\n    ],\n    \"timer\" => 60000,\n    \"custom_event\" => [\n        \"event\" => \"onload\"\n    ]\n  ],\n  \"settings\" => [\n    \"position\" => \"center-center\",\n    \"background_color\" => \"blue\",\n    \"height\" => 700,\n    \"width\" => 500,\n    \"close_cta\" => false,\n    \"close_esc\" => true,\n    \"close_click\" => true,\n    \"close_auto\" => 0,\n    \"delay\" => 0,\n    \"animation\" => \"fade-in\"\n  ],\n  \"frequency\" => [\n      \"always_show\" => true,\n      \"stop_after_interaction\" => false\n      \"show_cooldown\" => 1000\n  ],\n  \"group\" => \"group A\"\n]"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

204 No Content

400 Bad Request

{
  "code": 400,
  "title": "Bad request.",
  "message": "The request is not valid.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}

500 Internal Server Error

{
  "code": 500,
  "title": "Internal server error.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses