Planfix API task.add: Difference between revisions

From Planfix
Jump to: navigation, search
(Created page with "{{#seo: |title=Planfix API tasks.add |titlemode=append |keywords=Planfix, API, tasks.add, tasks, add, api |description=Planfix API tasks.add }} This feature lets you create a new task. Request format: <source lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <request method="task.add"> <account></account> <sid></sid> <task> <template></template> <title></title> <description></description> <importance></importance> <status></status> <statusS...")
 
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 9: Line 9:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<request method="task.add">
<request method="task.add">
  <account></account>
  <account></account>
  <sid></sid>
  <sid></sid>
  <task>
  <task>
    <template></template>
    <template></template>
    <title></title>
    <title></title>
    <description></description>
    <description></description>
    <importance></importance>
    <importance></importance>
    <status></status>
    <status></status>
    <statusSet></statusSet>
    <statusSet></statusSet>
    <checkResult></checkResult>
    <checkResult></checkResult>
    <owner>
    <owner>
      <id></id>
      <id></id>
    </owner>
    </owner>
    <parent>
    <parent>
      <id></id>
      <id></id>
    </parent>
    </parent>
    <project>
    <project>
      <id></id>
      <id></id>
    </project>
    </project>
    <client>
    <client>
      <id></id>
      <id></id>
    </client>
    </client>
    <beginDateTime></beginDateTime>
    <beginDateTime></beginDateTime>
    <startDateIsSet></startDateIsSet>
    <startDateIsSet></startDateIsSet>
    <startDate></startDate>
    <startDate></startDate>
    <startTimeIsSet></startTimeIsSet>
    <startTimeIsSet></startTimeIsSet>
    <startTime></startTime>
    <startTime></startTime>
    <endDateIsSet></endDateIsSet>
    <endDateIsSet></endDateIsSet>
    <endDate></endDate>
    <endDate></endDate>
    <endTimeIsSet></endTimeIsSet>
    <endTimeIsSet></endTimeIsSet>
    <endTime></endTime>
    <endTime></endTime>
    <isSummary></isSummary>
    <isSummary></isSummary>
    <duration></duration>
    <duration></duration>
    <durationUnit></durationUnit>
    <durationUnit></durationUnit>
    <durationIsSet></durationIsSet>
    <durationIsSet></durationIsSet>
    <workers>
    <workers>
      <users>
      <users>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </users>
      </users>
      <groups>
      <groups>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </groups>
      </groups>
    </workers>  
    </workers>    
    <members>
    <members>
      <users>
      <users>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </users>
      </users>
      <groups>
      <groups>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </groups>
      </groups>
    </members>    
    </members>      
    <auditors>
    <auditors>
      <users>
      <users>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </users>
      </users>
      <groups>
      <groups>
        <id></id>
        <id></id>
        <id></id>
        <id></id>
        <!-- ... -->
        <!-- ... -->
      </groups>
      </groups>
    </auditors>
    </auditors>
    <customData>
    <customData>
      <customValue>
      <customValue>
        <id></id>
        <id></id>
        <value></value>
        <value></value>
      </customValue>
      </customValue>
      <!-- ... -->
      <!-- ... -->
    </customData>
    </customData>
  </task>
  </task>
  <signature></signature>
  <signature></signature>
</request>
</request>
</source>
</source>
Line 94: Line 94:
!width="150"|Name !!width="200"| Type !!width="50%"| Value !! Notes
!width="150"|Name !!width="200"| Type !!width="50%"| Value !! Notes
|-
|-
|template ||id ||task template ID || iID in response from [[Planfix API task.getList|task.getList]] with target = template
|template ||id ||task template ID || id in response from [[Planfix API task.getList|task.getList]] with target = template
|-
|-
|colspan="4"|Creating a task based on a template using the API is currently incomplete.  
|colspan="4"|Creating a task based on a template using the API is currently incomplete. 


The layout from the template is applied (and, accordingly, any custom fields in the task) and some of its properties.  
The layout from the template is applied (and, accordingly, any custom fields in the task) and some of its properties. 


Currently, the following are not set from the template: task dates, auditors, data tags, files, reminders, checklists. Assignees and participants are set from the template if they're missing in the request.
Currently, the following are not set from the template: task dates, auditors, data tags, files, reminders, checklists. Assignees and participants are set from the template if they're missing in the request.
Line 106: Line 106:
|description || string||what the task is about; description ||
|description || string||what the task is about; description ||
|-
|-
|importance || enum||priority || for a list of valid values, see the task priority section
|importance || enum||priority || for a list of valid values, see the [[Planfix API:Task priority|task priority]] section
|-
|-
|status ||enum/int ||task status||Possible values can be found in the [[Planfix API: System task statuses |System task statuses]] section; or status IDs received as a result of calling the [[Planfix API taskStatus.getListOfSet | taskStatus.getListOfSet]] function
|status ||enum/int ||task status||Valid values can be found in the [[Planfix API: System task statuses |System task statuses]] section; or status IDs received as a result of calling the [[Planfix API TaskStatus.getListOfSet | TaskStatus.getListOfSet]] function
|-
|-
|statusSet ||int || task process || Process IDs can be retrieved by calling the [[Planfix API taskStatus.getSetList| taskStatus.getSetList]] function
|statusSet ||int ||    task process || Process IDs can be retrieved by calling the [[Planfix API TaskStatus.getSetList| TaskStatus.getSetList]] function
|-
|-
|checkResult ||bool || whether or not the task has mandatory result checking ||
|checkResult ||bool || whether or not the task has mandatory result checking ||
|-
|-
|owner || || создатель задачи||необязательное поле. Если не указано - берется пользователь от имени которого выполняется функция
|owner || || task creator||not required. If not specified, the user who executes the function will be used
|-
|-
|owner.id ||int ||идентификатор пользователя || если это контакт - нужно использовать userid из ответа [[ПланФикс API contact.get|contact.get]]
|owner.id ||int ||user identifier || if this is a contact, you must use the userid in the response from  [[Planfix API contact.get| contact.get]]
|-
|-
|parent || ||над задача || необязательное поле
|parent || ||parent task || not required
|-
|-
|parent.id ||int ||идентификатор задачи, которая будет являться над задачей ||допустимо значение 0 (ноль)
|parent.id ||int ||identifier of the task that will be the parent task ||value 0 (zero) allowed
|-
|-
|project || || в рамках какого проекта поставлена задача  ||
|project || || the project in which the task should be placed  ||
|-
|-
|project.id ||int ||идентификатор проекта ||
|project.id ||int ||project identifier ||
|-
|-
|client || || контрагент|| необязательный параметр
|client || || counterparty|| not required
|-
|-
|client.id ||int ||идентификатор контрагента (id из ответа contact.get) ||допустимо значение 0
|client.id ||int ||counterparty identifier ||value 0 is allowed
|-
|-
|beginDateTime ||DateTime || дата/время создания - не обязательный, по-умолчанию текущие || может заполняться, только если авторизация была сделана под сотрудником с правами администратора
|beginDateTime ||DateTime ||date/time of creation; not required; by default current date/time is used || can only be used if an employee with admin rights is logged in
|-
|-
|startDateIsSet ||bool (0/1)|| задана ли дата начала работы ||  
|startDateIsSet ||bool (0/1)|| whether or not a start date is set || 
|-
|-
|startDate ||Date || дата начала работы || в интерфейсе ПланФикс поле ''приступить к работе''
|startDate ||Date || start date || the '''get started''' field in the Planfix interface
|-
|-
|startTimeIsSet ||bool (0/1)|| задано ли время начала работы ||  
|startTimeIsSet ||bool (0/1)|| whether or not a start time is set || 
|-
|-
|startTime ||Time || время начала работы || в интерфейсе ПланФикс поле ''приступить к работе''
|startTime ||Time || start time || the '''get started''' field in the Planfix interface
|-
|-
|endDateIsSet ||bool (0/1)|| задана ли дата завершения работы ||  
|endDateIsSet ||bool (0/1)|| whether or not an end date is set || 
|-
|-
|endDate ||Date || дата завершения работы || в интерфейсе ПланФикс поле ''закончить работу До''
|endDate ||Date || end date || '''the finish before''' field in the Planfix interface
|-
|-
|endTimeIsSet ||bool (0/1)|| задано ли время завершения работы ||  
|endTimeIsSet ||bool (0/1)|| whether or not an end time is set || 
|-
|-
|endTime ||Time || время завершения работы || в интерфейсе ПланФикс поле ''закончить работу До''
|endTime ||Time || end time || '''the finish before''' field in the Planfix interface
|-
|-
|isSummary ||bool (0/1)|| задача является суммарной ||  
|isSummary ||bool (0/1)|| task is a summary task || 
|-
|-
|durationIsSet||bool|| задана ли длительность ||  
|durationIsSet||bool|| whether or not a duration is set || 
|-
|-
|duration||int|| длительность ||  
|duration||int|| duration || 
|-
|-
|durationUnit||int|| 0 - минуты, 1 - часы, 2 - дни ||  
|durationUnit||int|| 0 - minutes; 1 - hours; 2 - days || 
|-
|-
|workers || ||корневой элемент списка исполнителей задачи ||
|workers || ||root element of the list of task assignees ||
|-
|-
|workers.users || || корневой элемент списка пользователей, которым поставлена задача ||
|workers.users || || root element of the list of users to whom the task is assigned ||
|-
|-
|workers.users.id ||int ||идентификатор пользователя которому поставлена задача || для контактов - нужно использовать userid из ответа [[ПланФикс API contact.get|contact.get]]
|workers.users.id ||int ||identifier of the user to whom the task is assigned || for contacts, you must use the userid in the response from [[Planfix API contact.get|contact.get]]
|-
|-
|workers.groups || ||корневой элемент списка групп, которым поставлена задача ||
|workers.groups || ||root element of the list of groups to whom the task is assigned ||
|-
|-
|workers.groups.id ||int || идентификатор группы||
|workers.groups.id ||int || group identifier||
|-
|-
|members || ||корневой элемент списка участников задачи ||
|members || ||    root element of the list of task participants ||
|-
|-
|members.users || || корневой элемент списка участников задачи ||
|members.users || || root element of the list of task participants ||
|-
|-
|members.users.id ||int ||идентификатор участника задачи || для контактов - нужно использовать userid из ответа [[ПланФикс API contact.get|contact.get]]
|members.users.id ||int ||identifier of a task participant || for contacts, you must use the userid in the response from [[Planfix API contact.get|contact.get]]
|-
|-
|members.groups || ||корневой элемент списка групп участников ||
|members.groups || ||root element of the list of participant groups ||
|-
|-
|members.groups.id ||int || идентификатор группы участников ||
|members.groups.id ||int || participant group identifier ||
|-
|-
|auditors || ||корневой элемент списка аудиторов задачи, содержимое аналогично workers и members ||
|auditors || ||root element of the list of task auditors; the same as assignees and members ||
|-
|-
|customData|| ||значения пользовательских полей задачи ||
|customData|| ||values of task custom fields ||
|-
|-
|customData.customValue.id|| ||идентификатор пользовательского поля задачи ||
|customData.customValue.id|| ||task custom field identifier ||
|-
|-
|customData.customValue.value|| ||значение пользовательского поля задачи || (для полей типа набор задач, список сотрудников, набор записей справочника - идентификаторы через запятую в квадратных скобках)
|customData.customValue.value|| ||custom task field value || (for task set, employee list, and directory entry set field types, separate identifiers with commas in square brackets)
|-
|-
|}
|}
Добавляемые даты могут задаваться в двух форматах. Первый формат короткий, указывается только число, год и месяц. Второй формат - полный, дополнительно указывается время начала/завершения, если того требует задача.  
Dates may be added in one of two formats. First is the short format, which specifies only a date, year, and month. Second is the long format, which also specifies start/end time, if required for the task.


Ответ при удачном выполнении операции:
 
Response when operation is successfully executed:
<source lang="xml">
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
<response status="ok">
  <task>
  <task>
    <id></id>
    <id></id>
    <general></general>
    <general></general>
  </task>
  </task>
</response>
</response>
</source>
</source>
{| class="wikitable" style="margin-top: 1em; width:100% "
{| class="wikitable" style="margin-top: 1em; width:100% "
!width="150"|Название !!width="200"| Тип !!width="50%"| Значение !! Примечание
!width="150"| Name !!width="200"| Type !!width="50%"| Value !! Notes 
|-
|-
|task.id ||int ||идентификатор созданной задачи ||
|task.id ||int ||ID of the task created ||
|-
|-
|task.general ||int ||сквозной номер созданной задачи||
|task.general ||int || passthrough number of the created task||
|-
|-
|}
|}




В противном случае будет возвращен ответ с ошибкой:
Otherwise, an error response will be returned:
<source lang="xml">
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<response status="error">
<response status="error">
  <code></code>
  <code></code>
</response>
</response>
</source>
</source>




== Перейти ==
== Go To ==
*[[ПланФикс API:Задачи]]
*[[Planfix API:Tasks]]
*[[Коды ошибок]]
*[[Error codes XML API v1|Error codes]]
*[[Список функций]]
*[[List of functions]]

Latest revision as of 14:39, 22 March 2024

This feature lets you create a new task. Request format:

<?xml version="1.0" encoding="UTF-8"?>
<request method="task.add">
  <account></account>
  <sid></sid>
  <task>
    <template></template>
    <title></title>
    <description></description>
    <importance></importance>
    <status></status>
    <statusSet></statusSet>
    <checkResult></checkResult>
    <owner>
      <id></id>
    </owner>
    <parent>
      <id></id>
    </parent>
    <project>
      <id></id>
    </project>
    <client>
      <id></id>
    </client>
    <beginDateTime></beginDateTime>
    <startDateIsSet></startDateIsSet>
    <startDate></startDate>
    <startTimeIsSet></startTimeIsSet>
    <startTime></startTime>
    <endDateIsSet></endDateIsSet>
    <endDate></endDate>
    <endTimeIsSet></endTimeIsSet>
    <endTime></endTime>
    <isSummary></isSummary>
    <duration></duration>
    <durationUnit></durationUnit>
    <durationIsSet></durationIsSet>
    <workers>
      <users>
        <id></id>
        <id></id>
        <!-- ... -->
      </users>
      <groups>
        <id></id>
        <id></id>
        <!-- ... -->
      </groups>
    </workers>    
    <members>
      <users>
        <id></id>
        <id></id>
        <!-- ... -->
      </users>
      <groups>
        <id></id>
        <id></id>
        <!-- ... -->
      </groups>
    </members>      
    <auditors>
      <users>
        <id></id>
        <id></id>
        <!-- ... -->
      </users>
      <groups>
        <id></id>
        <id></id>
        <!-- ... -->
      </groups>
    </auditors>
    <customData>
      <customValue>
        <id></id>
        <value></value>
      </customValue>
      <!-- ... -->
    </customData>
  </task>
  <signature></signature>
</request>
Name Type Value Notes
template id task template ID id in response from task.getList with target = template
Creating a task based on a template using the API is currently incomplete. 

The layout from the template is applied (and, accordingly, any custom fields in the task) and some of its properties. 

Currently, the following are not set from the template: task dates, auditors, data tags, files, reminders, checklists. Assignees and participants are set from the template if they're missing in the request.

title string task name
description string what the task is about; description
importance enum priority for a list of valid values, see the task priority section
status enum/int task status Valid values can be found in the System task statuses section; or status IDs received as a result of calling the TaskStatus.getListOfSet function
statusSet int     task process Process IDs can be retrieved by calling the TaskStatus.getSetList function
checkResult bool whether or not the task has mandatory result checking
owner task creator not required. If not specified, the user who executes the function will be used
owner.id int user identifier if this is a contact, you must use the userid in the response from   contact.get
parent parent task not required
parent.id int identifier of the task that will be the parent task value 0 (zero) allowed
project the project in which the task should be placed  
project.id int project identifier
client counterparty not required
client.id int counterparty identifier value 0 is allowed
beginDateTime DateTime date/time of creation; not required; by default current date/time is used can only be used if an employee with admin rights is logged in
startDateIsSet bool (0/1) whether or not a start date is set  
startDate Date start date the get started field in the Planfix interface
startTimeIsSet bool (0/1) whether or not a start time is set  
startTime Time start time the get started field in the Planfix interface
endDateIsSet bool (0/1) whether or not an end date is set  
endDate Date end date the finish before field in the Planfix interface
endTimeIsSet bool (0/1) whether or not an end time is set  
endTime Time end time the finish before field in the Planfix interface
isSummary bool (0/1) task is a summary task  
durationIsSet bool whether or not a duration is set  
duration int duration  
durationUnit int 0 - minutes; 1 - hours; 2 - days  
workers root element of the list of task assignees
workers.users root element of the list of users to whom the task is assigned
workers.users.id int identifier of the user to whom the task is assigned for contacts, you must use the userid in the response from contact.get
workers.groups root element of the list of groups to whom the task is assigned
workers.groups.id int group identifier
members     root element of the list of task participants
members.users root element of the list of task participants
members.users.id int identifier of a task participant for contacts, you must use the userid in the response from contact.get
members.groups root element of the list of participant groups
members.groups.id int participant group identifier
auditors root element of the list of task auditors; the same as assignees and members
customData values of task custom fields
customData.customValue.id task custom field identifier
customData.customValue.value custom task field value (for task set, employee list, and directory entry set field types, separate identifiers with commas in square brackets)

Dates may be added in one of two formats. First is the short format, which specifies only a date, year, and month. Second is the long format, which also specifies start/end time, if required for the task.


Response when operation is successfully executed:

<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
  <task>
    <id></id>
    <general></general>
  </task>
</response>
Name Type Value Notes 
task.id int ID of the task created
task.general int  passthrough number of the created task


Otherwise, an error response will be returned:

<?xml version="1.0" encoding="UTF-8"?>
<response status="error">
  <code></code>
</response>


Go To