Вебхуки объектов

Все изменения в объектах могут быть отправлены вебхуком. Здесь приведены примеры тела запроса для каждого типа события, связанного с объектами. Как и в остальных частях API, данные передаются в формате JSON.

Объект создан

{
  "event_type": "site_created",
  "context": {
    "source": "web",
    "happened_at": "2015-01-19T21:02:04.617Z",
    "created_at": "2015-01-19T21:02:04.617Z",
    "user_uuid": "8ebd12cc-b2d9-407c-a4f4-5943263d54a4",
    "user_email": "jack@black",
    "device_uuid": null
  },
  "site": {
    "uuid": "dc62cfdf-f9f1-59ec-80bd-ff5da151e515",
    "external_id": "kelheimer-6",
    "name": "RV Media Kelheimer Straße",
    "description": "RV Media",
    "contacts": [
      {
        "name": "Herr Karl",
        "value": "0179-1234567",
        "type": "phone"
      }
    ],
    "address": {
      "formatted": "Kelheimer Str. 6, 10777 Berlin, Germany",
      "entrance_no": null,
      "apartment": null,
      "floor": "3",
      "description": null,
      "geolocation": {
        "longitude": 13.3363265,
        "latitude": 52.4984896
      }
    },
    "client": {
      "uuid": "3945339f-97d2-5e51-8148-f38fe693695f",
      "external_id": "rv-media"
    },
    "version": 1
  }
}

Объект обновлен

{
  "event_type": "site_updated",
  "context": {
    "source": "web",
    "happened_at": "2015-01-20T21:02:04.617Z",
    "created_at": "2015-01-20T21:02:04.617Z",
    "user_uuid": "8ebd12cc-b2d9-407c-a4f4-5943263d54a4",
    "user_email": "jack@black",
    "device_uuid": null
  },
  "site": {
    "uuid": "dc62cfdf-f9f1-59ec-80bd-ff5da151e515",
    "external_id": "kelheimer-6",
    "name": "RV Media Kelheimer Straße",
    "description": "RV Media",
    "contacts": [],
    "address": {
      "formatted": "Kelheimer Str. 6, 10777 Berlin, Germany",
      "entrance_no": "1",
      "apartment": null,
      "floor": "3",
      "description": null,
      "geolocation": {
        "longitude": 13.3363265,
        "latitude": 52.4984896
      }
    },
    "client": null,
    "version": 3,
    "previous": {
      "external_id": "kelheimer-6",
      "name": "RV Media Kelheimer Straße",
      "description": "RV Media",
      "contacts": [
        {
          "name": "Herr Karl",
          "value": "0179-1234567",
          "type": "phone"
        }
      ],
      "address": {
        "formatted": "Kelheimer Str. 6, 10777 Berlin, Germany",
        "entrance_no": null,
        "apartment": null,
        "floor": "3",
        "description": null,
        "geolocation": {
          "longitude": 13.3363265,
          "latitude": 52.4984896
        }
      },
      "client": {
        "uuid": "3945339f-97d2-5e51-8148-f38fe693695f",
        "external_id": "rv-media"
      },
      "version": 2
    }
  }
}

Объект удален

{
  "event_type": "site_removed",
  "context": {
    "source": "web",
    "happened_at": "2015-01-21T21:02:04.617Z",
    "created_at": "2015-01-21T21:02:04.617Z",
    "user_uuid": "8ebd12cc-b2d9-407c-a4f4-5943263d54a4",
    "user_email": "jack@black",
    "device_uuid": null
  },
  "site": {
    "uuid": "dc62cfdf-f9f1-59ec-80bd-ff5da151e515",
    "external_id": "kelheimer-6",
    "name": "RV Media Kelheimer Straße",
    "description": "RV Media",
    "contacts": [],
    "address": {
      "formatted": "Kelheimer Str. 6, 10777 Berlin, Germany",
      "entrance_no": "1",
      "apartment": null,
      "floor": "3",
      "description": null,
      "geolocation": {
        "longitude": 13.3363265,
        "latitude": 52.4984896
      }
    },
    "client": null,
    "version": 17
  }
}

См. также