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

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/<DOMAIN>/service/cc/arm/save_user_data

Коды ответов:

200 — Ошибки передаются в теле ответа

Ошибки, передаваемые в теле ответа:

  • cannot_perform_cmd

XSD-схема XML-запроса/ответа:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:include schemaLocation="error.xsd"/>

    <xs:complexType name="SaveUserData">
        <xs:sequence>
            <xs:element name="user_data" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"  />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="agent_id" use="optional"/>
        <xs:attribute name="application_id" use="required"/>
    </xs:complexType>

    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="save_user_data" type="SaveUserData"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="response">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="ok"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
XML

Пример использует технологию websocket

Пример:
Запрос:

0100000007180050save_user_data
[
  {
    "_name": "in",
    "_content": [
      {
        "_name": "request",
        "_content": [
          {
            "_name": "save_user_data",
            "_attributes": {
              "application_id": "hodor"
            },
            "_content": [
              {
                "_name": "user_data",
                "_content": [
                  {
                    "_name": "user_data",
                    "_attributes": {
                      "user_data": "{\"myReports\":[{\"id\":\"1607932267415\",\"name\":\"new_test_new\",\"plotDef\":[{\"id\":58019194,\"chartType\":\"line\",\"visible\":true,\"name\":\"................ ............\",\"queueIds\":[],\"queueMetricIds\":[],\"operatorIds\":[\"102\"],\"operatorMetricIds\":[\"incomingCallsCount\"]}],\"dateFrom\":\"2020-12-07T00:00:00.000+07:00\",\"dateTo\":\"2020-12-14T23:59:59.000+07:00\",\"dynamicDate\":\"week\",\"intervalType\":\"auto\"}]}"
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
]                    
PY

Код ответа:

200

Ответ:

0100000002210050200
[
  {
    "_name": "out",
    "_attributes": {
      "xmlns:xs": "http://www.w3.org/2001/XMLSchema-instance",
      "xs:noNamespaceSchemaLocation": "save_user_data.xsd"
    },
    "_content": [
      {
        "_name": "response",
        "_content": [
          {
            "_name": "ok"
          }
        ]
      }
    ]
  }
]
PY