Planfix API file.upload
From Planfix
This function allows you to attach a file to a project or task. Request format:
<?xml version="1.0" encoding="UTF-8"?>
<request method="file.upload">
<account></account>
<sid></sid>
<task>
<id></id>
</task>
<project>
<id></id>
</project>
<owner>
<id></id>
</owner>
<target></target>
<action>
<id></id>
</action>
<files>
<file>
<name></name>
<sourceType></sourceType>
<otherFile>
<id></id>
<url></url>
</otherFile>
<body></body>
<description></description>
<newversion></newversion>
</file>
</files>
<notifiedList>
<users>
<id></id>
<id></id>
<!-- ... -->
</users>
</notifiedList>
<signature></signature>
</request>
Name | Type | Value | Note |
---|---|---|---|
silent | bool | if value is 1 - no notifications about the change are sent | mandatory value 1 for mass recurring task updates |
task | under which task is it being saved | excludes the presence of project | |
task.id | int | task identifier | |
project | under which project is it being saved | used if task is not set | |
project.id | int | project identifier | |
owner | author of the uploaded files | optional field. If not specified, the user on whose behalf the function is executed is taken | |
owner.id | int | author's file identifier | |
target | string | where to attach the file, can take one of the following values:
|
optional parameter, by default the file is attached by a new action to the task |
action.id | int | identifier of the action to which the file is attached | |
files | root element containing the list of saved files | ||
file | saved file | ||
file.name | string | name of the saved file | ignored if sourceType=PROJECT |
file.sourceType | enum | source type | list of valid values see in file source types |
file.otherFile | Use an already existing file | used when sourceType: INTERNET, PROJECT | |
file.otherFile.id | int | file identifier, used when linking to a file from a project | sourceType=PROJECT |
file.otherFile.url | string | URL of the file on the Internet | used only when sourceType=INTERNET |
file.body | string | file body encoded in base64 | used when sourceType=FILESYSTEM |
file.description | string | brief description of the file contents | optional parameter, ignored if sourceType=PROJECT |
file.newversion | boolean | if the value is "1", when the file name matches a previously uploaded one, no error is issued, but the file is uploaded as a new version of the existing one | optional parameter |
notifiedList | list of users to be notified | ||
notifiedList.users | root element of the user list | ||
notifiedList.users.id | int | user identifier |
Result of successful function execution:
<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
<files>
<file>
<uniqueId></uniqueId>
<name></name>
</file>
<file>
<uniqueId></uniqueId>
<name></name>
</file>
<!-- ... -->
</files>
</response>
Name | Type | Value | Note |
---|---|---|---|
action.id | int | identifier of the added action |
The response is a list of files with file names and assigned identifiers.
Otherwise, an error response will be returned:
<?xml version="1.0" encoding="UTF-8"?>
<response status="error">
<code></code>
<id></id>
<name></name>
</response>
The id and name parameters are present when code=9006 (the file name matches the name of an existing one in this project), and they contain the name and identifier of the existing file.