Hc_custom_cb - Управление виджетом сервиса "custom callback"
Hc_custom_cb_new
Команда по созданию callback-виджета.
Аналог команды в CoCon:
/domain/<DOMAIN>/custom_cb/new
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:9999/commands/custom_cb_new
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="common_types.xsd"/>
<!-- Types -->
<xs:complexType name="widgetType">
<xs:sequence>
<xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="from_number" type="nonEmptyString" use="required"/>
<xs:attribute name="name" type="nonEmptyString" use="required"/>
<xs:attribute name="scenario" type="nonEmptyString" use="optional"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="requestType">
<xs:sequence>
<xs:element name="widget" type="widgetType"/>
</xs:sequence>
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="responseType">
<xs:attribute name="error" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
http://192.168.1.21:9999/commands/custom_cb_new
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_custom_cb_new.xsd">
<request domain="nick">
<widget from_number="1563" name="test_ccb" scenario="default" description="abc"/>
</request>
</in>
Ответ: 200
<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_custom_cb_new.xsd">
<response id="0655e332b2bf7dd0"/>
</out>
Hc_custom_cb_set
Команда по редактированию callback-виджета.
Аналог команды в CoCon:
/domain/<DOMAIN>/custom_cb/set
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:9999/commands/custom_cb_set
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="common_types.xsd"/>
<!-- Types -->
<xs:complexType name="widgetType">
<xs:sequence>
<xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="nonEmptyString" use="required"/>
<xs:attribute name="from_number" type="nonEmptyString" use="optional"/>
<xs:attribute name="name" type="nonEmptyString" use="optional"/>
<xs:attribute name="scenario" type="nonEmptyString" use="optional"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="requestType">
<xs:sequence>
<xs:element name="widget" type="widgetType"/>
</xs:sequence>
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="responseType">
<xs:attribute name="error" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
http://192.168.1.21:9999/commands/custom_cb_set
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_custom_cb_set.xsd">
<request domain="nick">
<widget id="0655e2e5c48fded2">
<property name="key1" value="value111" />
<property name="key2" value="value22" />
</widget>
</request>
</in>
Ответ: 200
<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_custom_cb_set.xsd">
<response id="0655e2e5c48fded2"/>
</out>
Hc_custom_cb_list
Команда получения списка callback-виджетов.
Аналог команды в CoCon:
/domain/<DOMAIN>/custom_cb/list
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:9999/commands/custom_cb_list
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="common_types.xsd"/>
<!-- Types -->
<xs:complexType name="widgetType">
<xs:sequence>
<xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="from_number" type="xs:string" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="scenario" type="xs:string" use="required"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="requestType">
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="responseType">
<xs:sequence>
<xs:element name="widget" type="widgetType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос:
http://192.168.1.21:9999/commands/custom_cb_list
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_custom_cb_list.xsd">
<request domain="biysk.local"/>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_custom_cb_list.xsd">
<response>
<widget id="06220252f0137bea" from_number="240473" name="new_73" scenario="0622071a81711369" description="new_wid"/>
<widget id="062229da8ce73a45" from_number="240471" name="check_widget" scenario="default_custom_callback" description="abc">
<property name="key1" value="value111"/>
<property name="key2" value="value22"/>
</widget>
</response>
</out>
Hc_custom_cb_remove
Команда удаления callback-виджета.
Аналог команды в CoCon:
/domain/<DOMAIN>/custom_cb/delete/
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://server:9999/commands/custom_cb_remove
Код HTTP-ответа:
- 201 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="widgetType">
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="requestType">
<xs:sequence>
<xs:element name="widget" type="widgetType"/>
</xs:sequence>
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="responseType">
<xs:attribute name="error" type="xs:string" use="optional"/>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос:
http://192.168.1.21:9999/commands/custom_cb_remove
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_custom_cb_remove.xsd">
<request domain="biysk.local">
<widget id="062229da8ce73a45" />
</request>
</in>
Ответ:
В случае успеха будет 201 ответ, в случае ошибки 404 + xml с описанием ошибки:
<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_custom_cb_remove.xsd">
<response error="not_found"/>
</out>