Widgets
Get widgets
https://api.lytics.io/v2/widgetGet all widgets for an account. Each version of each widget is returned unless latest=true.
{
"_meta": {},
"data": [
{
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
}
],
"request_id": "string",
"status": 0
}Create widget
https://api.lytics.io/v2/widgetCreate a widget. The server assigns its id and it starts as version 1 in draft; the request must not name an id or version, or a state other than draft.
{
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
}{
"_meta": {},
"data": {
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
},
"request_id": "string",
"status": 0
}Get widget
https://api.lytics.io/v2/widget/{id}Get every version of a widget, or only the latest with latest=true.
{
"_meta": {},
"data": [
{
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
}
],
"request_id": "string",
"status": 0
}Update widget
https://api.lytics.io/v2/widget/{id}Update the version named in the body (404 if it does not exist), or create the next draft version when the body names none. State only changes through publish and pause; a body state must match the stored one. A published version's config, type and targeting cannot change until it is paused.
{
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
}{
"_meta": {},
"data": {
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
},
"request_id": "string",
"status": 0
}Delete widget
https://api.lytics.io/v2/widget/{id}Delete every version of a widget. Refused with 409 while any version is published.
{
"_meta": {},
"data": {},
"request_id": "string",
"status": 0
}Get widget version
https://api.lytics.io/v2/widget/{id}/{version}Get a specific version of a widget.
{
"_meta": {},
"data": {
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
},
"request_id": "string",
"status": 0
}Delete widget version
https://api.lytics.io/v2/widget/{id}/{version}Delete one version of a widget. Refused with 409 while that version is published.
{
"_meta": {},
"data": {},
"request_id": "string",
"status": 0
}Pause widget version
https://api.lytics.io/v2/widget/{id}/{version}/pausePause a published widget version.
{
"_meta": {},
"data": {
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
},
"request_id": "string",
"status": 0
}Publish widget version
https://api.lytics.io/v2/widget/{id}/{version}/publishPublish a widget version. Refused with 409 while another version is published; that version must be paused first. Refused with 400 while the version has issues; the response's data.issues lists them.
{
"_meta": {},
"data": {
"aid": 0,
"config": {},
"created": "2019-08-24T14:15:22Z",
"custom_rule_function": "string",
"description": "string",
"excluded_segment_ids": [
"string"
],
"id": "string",
"issues": [
{
"code": "segment_not_found",
"field": "target_segment_ids",
"message": "string",
"value": "string"
}
],
"label": "string",
"modified": "2019-08-24T14:15:22Z",
"personalization_key": "string",
"published_at": "2019-08-24T14:15:22Z",
"slug": "string",
"state": "draft",
"state_modified_at": "2019-08-24T14:15:22Z",
"target_segment_ids": [
"string"
],
"version": 0,
"widget_type": "message"
},
"request_id": "string",
"status": 0
}