Hc_calendar_timetable_show

Команда позволяет вывести календарь и действующее расписание.

Аналог команды в CoCon:

/domain/<DOMAIN>/calendar/timetable/show

Шаблон URL запроса

http://host:port/commands/calendar_timetable_show

Код HTTP-ответа:

200 – в случае успеха;
404 – в случае ошибки.

XML-схема

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
     <xs:include schemaLocation="error.xsd"/>
    <!-- timetableType -->
    <xs:complexType name="timetableType">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>
    <!-- resultType-->
    <xs:complexType name="resultType">
        <xs:sequence>
            <xs:element name="timetable" type="timetableType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:attribute name="domain" type="xs:string" use="optional"/>
                        <xs:attribute name="timetable" type="xs:string" use="optional"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out-->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="error" type="errorType"/>
                <!--Positive case-->
                <xs:element name="result" type="resultType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

Запрос:
http://192.168.1.21:9999/commands/calendar_timetable_show

<?xml version="1.0"?>
<in
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_calendar_timetable_show.xsd">
    <request domain="biysk.local"/>
</in>
CODE

Ответ:

200

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_calendar_timetable_show.xsd">
    <result>
        <timetable name="tt4" value="{"name":"tt4","filters":[{"date":"1 2 3 4 5","from":"8:0","to":"17:0"}],"properties":[]}"/>
    </result>
</out>

CODE

Hc_calendar_timetable_set

Команда предназначена для установки нового расписания, рабочих, выходных, праздничных дней.

Аналог команды в CoCon:

/domain/<DOMAIN>/calendar/timetable/add-interval
/domain/<DOMAIN>/calendar/timetable/remove-interval

Шаблон URL запроса

http://host:port/commands/calendar_timetable_set

Код HTTP-ответа:

200 – в случае успеха;
404 – в случае ошибки.

XML-схема

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- <error> -->
  <xs:complexType name="errorType">
    <xs:attribute name="name" type="xs:string" use="optional" />
    <xs:attribute name="reason" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
  </xs:complexType>
    <!-- timetableType -->
    <xs:complexType name="timetableType">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>
    <!-- requestType-->
    <xs:complexType name="requestType">
        <xs:sequence>
            <xs:element name="timetable" type="timetableType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="domain" type="xs:string" use="optional"/>
    </xs:complexType>
    <!-- resultType-->
  <xs:complexType name="resultType">
    <xs:choice>
      <xs:sequence>
        <xs:element name="error" type="errorType"/>
      </xs:sequence>
        <!--Positive case-->
      <xs:element name="ok"/>
    </xs:choice>
  </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="result" type="resultType"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>
CODE

Пример

Запрос:
http://192.168.1.21:9999/commands/calendar_timetable_set

<?xml version="1.0"?>
  <in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_calendar_timetable_set.xsd">
    <request domain="test.domain">
      <timetable name="tt4" value="{&quot;name&quot;:&quot;:tt4&quot;,&quot;filters&quot;:[{&quot;date&quot;:&quot;1 2 3 4 5&quot;,&quot;from&quot;:&quot;9:0&quot;,&quot;to&quot;:&quot;18:0&quot;}],&quot;properties&quot;:[]}"/>
    </request>
  </in>

Ответ:

200

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_calendar_timetable_set.xsd">
    <result>
        <ok/>
    </result>
</out>
CODE

Hc_calendar_timetable_remove

Команда предназначена для удаления текущего календаря и расписания работы.

Аналог команды в CoCon:

domain/<DOMAIN>/calendar/timetable/remove

Шаблон URL запроса

http://host:port/commands/calendar_timetable_remove

Код HTTP-ответа:

200 – в случае успеха;
404 – в случае ошибки.

XML-схема

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- <error> -->
  <xs:complexType name="errorType">
    <xs:attribute name="name" type="xs:string" use="optional" />
    <xs:attribute name="reason" type="xs:string" use="optional" />
    <!-- entity="[nonempty_string()]" -->
  </xs:complexType>
  <!-- timetableType -->
  <xs:complexType name="timetableType">
    <xs:attribute name="name" type="xs:string" use="required"/>
  </xs:complexType>
  <!-- requestType-->
  <xs:complexType name="requestType">
    <xs:sequence>
      <xs:element name="timetable" type="timetableType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="domain" type="xs:string" use="optional"/>
  </xs:complexType>
  <!-- resultType-->
  <xs:complexType name="resultType">
    <xs:choice>
      <xs:sequence>
        <xs:element name="error" type="errorType"/>
      </xs:sequence>
        <!--Positive case-->
      <xs:element name="ok"/>
    </xs:choice>
  </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="result" type="resultType"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>
CODE

Пример

Запрос:
http://192.168.1.21:9999/commands/calendar_timetable_remove

<?xml version="1.0"?>
<in
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_calendar_timetable_remove.xsd">
    <request domain="biysk.local">
        <timetable name="tt4"/>
    </request>
</in>
CODE

Ответ:

200

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_calendar_timetable_remove.xsd">
    <result>
        <ok/>
    </result>
</out>
CODE