├── MANIFEST.in ├── bitrix24 ├── __init__.py └── bitrix24.py ├── docs └── source │ ├── index.rst │ ├── methods │ ├── im.rst │ ├── log.rst │ ├── task.elapseditem.rst │ ├── task.checklistitem.rst │ ├── user.rst │ ├── common.rst │ └── task.item.rst │ └── conf.py ├── LICENSE ├── setup.py ├── README.rst └── tests └── testBitrix24.py /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include bitrix24 3 | include README.rst 4 | include tests -------------------------------------------------------------------------------- /bitrix24/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """Init file for Bitrix24 module""" 4 | from .bitrix24 import * 5 | 6 | __author__ = 'Vladislav Sikach' 7 | __author_email__ = 'github@sijmusic.info' 8 | __version__ = '1.0.1' 9 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to bitrix24-python-sdk's documentation! 2 | =============================================== 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | methods/common 10 | methods/log 11 | methods/user 12 | methods/task.item 13 | methods/task.checklistitem 14 | methods/task.elapseditem 15 | methods/im 16 | 17 | 18 | Indices and tables 19 | ================== 20 | 21 | * :ref:`genindex` 22 | * :ref:`search` 23 | 24 | -------------------------------------------------------------------------------- /docs/source/methods/im.rst: -------------------------------------------------------------------------------- 1 | IM Methods 2 | ========== 3 | 4 | IM Methods 5 | 6 | im.notify 7 | --------- 8 | 9 | Notify specified user. 10 | 11 | **Parameters:** 12 | 13 | * ``to`` - Recipient ID 14 | * ``message`` - Message text 15 | * ``type`` - Author message: ``USER`` or ``SYSTEM``. If set ``SYSTEM`` message send from application. ``USER`` is a default value. 16 | 17 | **Result fields:** 18 | 19 | Notify message id. 20 | 21 | **Example:** :: 22 | 23 | bx24.call('im.notify', {'to': 1, 24 | 'message': 'Hello, world!', 25 | 'type': 'SYSTEM'}) 26 | 27 | **Result:** :: 28 | 29 | {u'result': 24} 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Vladislav Sikach 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """Setup file for Bitrix24""" 4 | 5 | from distutils.core import setup 6 | from setuptools import find_packages 7 | 8 | setup( 9 | name='bitrix24-python-sdk', 10 | version='1.0.1', 11 | install_requires=['requests', 'multidimensional_urlencode'], 12 | packages=find_packages(), 13 | url='https://github.com/gebvlad/bitrix24-python-sdk', 14 | license='MIT', 15 | author='Vladislav Sikach', 16 | author_email='github@sijmusic.info', 17 | description='Bitrix24 REST API wrapper', 18 | keywords='bitrix24 api rest', 19 | classifiers=[ 20 | # How mature is this project? Common values are 21 | # 3 - Alpha 22 | # 4 - Beta 23 | # 5 - Production/Stable 24 | 'Development Status :: 5 - Production/Stable', 25 | 26 | # Indicate who your project is intended for 27 | 'Intended Audience :: Developers', 28 | 'Natural Language :: Russian', 29 | 'Natural Language :: English', 30 | 'Operating System :: OS Independent', 31 | 'Topic :: Software Development :: Libraries :: Python Modules', 32 | 33 | # Pick your license as you wish (should match "license" above) 34 | 'License :: OSI Approved :: MIT License', 35 | 36 | # Specify the Python versions you support here. In particular, ensure 37 | # that you indicate whether you support Python 2, Python 3 or both. 38 | 'Programming Language :: Python :: 2', 39 | 'Programming Language :: Python :: 2.6', 40 | 'Programming Language :: Python :: 2.7', 41 | 'Programming Language :: Python :: 3', 42 | 'Programming Language :: Python :: 3.2', 43 | 'Programming Language :: Python :: 3.3', 44 | 'Programming Language :: Python :: 3.4', 45 | ], 46 | ) 47 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | bitrix24-python-sdk 2 | =================== 3 | 4 | .. image:: https://img.shields.io/pypi/v/bitrix24-python-sdk.svg 5 | :target: https://pypi.python.org/pypi/bitrix24-python-sdk 6 | 7 | .. image:: https://img.shields.io/pypi/dm/bitrix24-python-sdk.svg?maxAge=2592000 8 | :target: https://pypi.python.org/pypi/bitrix24-python-sdk 9 | 10 | 11 | Description 12 | =========== 13 | 14 | *Bitrix24 REST API wrapper* 15 | 16 | bitrix24-python-sdk is a simple API wrapper for working with Bitrix24 REST API 17 | 18 | - Bitrix24 API documentation - English: https://training.bitrix24.com/rest_help/ 19 | - Bitrix24 API documentation - Russian: http://dev.1c-bitrix.ru/rest_help/ 20 | 21 | 22 | Requirements 23 | ============ 24 | 25 | - Python 2.6+ or 3.2+ 26 | - requests 27 | - multidimensional_urlencode 28 | 29 | Installation 30 | ============ 31 | 32 | .. code-block:: bash 33 | 34 | pip install bitrix24-python-sdk 35 | 36 | 37 | Quickstart 38 | ========== 39 | 40 | .. code-block:: python 41 | 42 | from bitrix24 import Bitrix24 43 | 44 | bx24 = Bitrix24('YOUR_THIRD_LEVEL_DOMAIN', 'YOUR_AUTH_TOKEN') 45 | 46 | print(bx24.call('app.info')) 47 | 48 | Notes 49 | ===== 50 | 51 | For some functions the order of parameters is important. 52 | For example, methods from scope "task": 53 | 54 | .. code-block:: python 55 | 56 | bx24.call( 57 | 'task.item.list', 58 | {'ORDER': {'GROUP_ID': 'asc'}}, 59 | {'FILTER': {'GROUP_ID': 1,'REAL_STATUS': {0: STATE_NEW}}}, 60 | {'PARAMS': {'NAV_PARAMS': {'nPageSize': 50, 'iNumPage': 2}}} 61 | ) 62 | 63 | Tests 64 | ===== 65 | 66 | 1. Put your access data at tests/testBitrix24.py 67 | 2. Run tests 68 | 69 | .. code-block:: bash 70 | 71 | python -m unittest discover 72 | 73 | 74 | Author 75 | ====== 76 | 77 | Vladislav Sikach - `github@sijmusic.info `_ 78 | See also the list of `contributors `_ which participated in this project 79 | 80 | 81 | Need custom Bitrix24 application? 82 | ================================= 83 | email: `github@sijmusic.info `_ 84 | 85 | 86 | TODO 87 | ==== 88 | 89 | 1. Documentation -------------------------------------------------------------------------------- /tests/testBitrix24.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """Tests for Bitrix24""" 4 | 5 | import unittest 6 | from bitrix24 import Bitrix24 7 | 8 | 9 | class TestBitrix24WithCorrectAccessTokens(unittest.TestCase): 10 | access_data = { 11 | 'auth_token': '', 12 | 'refresh_token': '', 13 | 'domain': '', 14 | 'client_id': '', 15 | 'client_secret': '' 16 | } 17 | 18 | def check_access_data(self): 19 | for i in self.access_data: 20 | if '``. Where ```` is ID of user. For all users use ``UA`` 17 | * ``SG`` - sonet group ids. Must be in format ``SG``. Where ```` is ID of sonet group. 18 | * ``DR`` - departament ids. Must be in format ``DR``. Where ```` is ID of departament. 19 | 20 | **Result fields:** 21 | 22 | Added message id 23 | 24 | **Possible errors:** 25 | 26 | * ``ERROR_IN_ACTION`` - You can not add two identical consecutive messages 27 | 28 | 29 | **Example:** :: 30 | 31 | bx24.call('log.blogpost.add', { 32 | 'POST_MESSAGE': 'Test message', 33 | 'POST_TITLE': 'Test title', 34 | 'SPERM': { 35 | # Add to user with id 1 and for all authorized users 36 | 'U': ['U1', 'UA'], 37 | 38 | # Add to groups with ids 12 and 14 39 | 'SG': ['SG14', 'SG12'], 40 | 41 | # Add to departament with ids 1 and 9 42 | 'DR': ['DR1', 'DR9'] 43 | }}) 44 | 45 | **Result:** :: 46 | 47 | {u'result': 68} 48 | 49 | 50 | log.blogpost.get 51 | ---------------- 52 | 53 | Get message list from Activity Stream for current users 54 | 55 | **Result fields:** 56 | 57 | * ``result`` - Messages list 58 | * ``total`` - Total messages count 59 | 60 | **Example:** :: 61 | 62 | bx24.call('log.blogpost.get') 63 | 64 | **Result:** :: 65 | 66 | {u'result': [{u'AUTHOR_ID': u'1', 67 | u'BLOG_ID': u'1', 68 | u'CATEGORY_ID': u'', 69 | u'CODE': None, 70 | u'DATE_PUBLISH': u'20.08.2016 01:19:54', 71 | u'DETAIL_TEXT': u'Test message', 72 | u'ENABLE_COMMENTS': u'Y', 73 | u'HAS_COMMENT_IMAGES': None, 74 | u'HAS_IMAGES': u'N', 75 | u'HAS_PROPS': u'N', 76 | u'HAS_SOCNET_ALL': u'N', 77 | u'HAS_TAGS': u'N', 78 | u'ID': u'76', 79 | u'MICRO': u'N', 80 | u'NUM_COMMENTS': u'0', 81 | u'PUBLISH_STATUS': u'P', 82 | u'TITLE': u'Test title', 83 | u'VIEWS': None}, 84 | ... 85 | ], 86 | u'total': 18} 87 | 88 | 89 | 90 | 91 | log.blogpost.getusers.important 92 | ------------------------------- 93 | 94 | Return list of user ids that read important message 95 | 96 | **Parameters:** 97 | 98 | * ``POST_ID`` - Important message id 99 | 100 | **Result fields:** 101 | 102 | * ``result`` - List of user ids that read important message 103 | 104 | **Possible errors:** 105 | 106 | * ``Wrong post ID`` - If parameter ``POST_ID`` not passed to method 107 | 108 | 109 | **Example:** :: 110 | 111 | bx24.call('log.blogpost.getusers.important', {'POST_ID': 66}) 112 | 113 | **Result:** :: 114 | 115 | {u'result': [u'1']} 116 | 117 | -------------------------------------------------------------------------------- /docs/source/methods/task.elapseditem.rst: -------------------------------------------------------------------------------- 1 | Task elapsed items Methods 2 | ========================== 3 | 4 | Task elapsed items Methods 5 | 6 | 7 | task.elapseditem.getmanifest 8 | ---------------------------- 9 | Returns a list of methods and their description. 10 | 11 | **Parameters:** 12 | 13 | * ```` - 14 | 15 | **Result fields:** 16 | 17 | * ```` - 18 | 19 | **Possible errors:** 20 | 21 | * ```` - 22 | 23 | 24 | **Example:** :: 25 | 26 | 27 | 28 | **Result:** :: 29 | 30 | 31 | task.elapseditem.getlist 32 | ------------------------ 33 | Returns a list of entries about the elapsed time for a task. 34 | 35 | **Parameters:** 36 | 37 | * ``TASKID`` - Task identifier. Required parameter. 38 | * ``ORDER`` - Array for result sorting. Sorting field may take the following values: 39 | * ``ID`` – identifier of the entry about elapsed time; 40 | * ``USER_ID`` – identifier of the user on whose behalf the entry about the elapsed time was made; 41 | * ``MINUTES`` – elapsed time, minutes; 42 | * ``SECONDS`` – elapsed time, seconds ; 43 | * ``CREATED_DATE`` – entry creation date; 44 | * ``DATE_START`` – start date; 45 | * ``DATE_STOP`` – end date. 46 | Sorting direction can take the following values: 47 | * ``asc`` – ascending; 48 | * ``desc`` – descending; 49 | Optional. By default it is filtered by descending of the entry elapsed time identifier. 50 | * ``FILTER`` - Filtered field can take the following values: 51 | * ``ID`` – comment identifier; 52 | * ``USER_ID`` – identifier of the user on whose behalf the entry about the elapsed time was made; 53 | * ``CREATED_DATE`` – entry creation date. 54 | Filtration type may be indicated before the name of the field to be filtered: 55 | * ``"!"`` – not equal; 56 | * ``"<"`` – less; 57 | * ``"<="`` – less or equal; 58 | * ``">"`` – more; 59 | * ``">="`` – more or equal. 60 | filter values - a single value or an array. 61 | Optional. By default entries are not filtered. 62 | 63 | **Result fields:** 64 | 65 | * ``result`` - 66 | * ``COMMENT_TEXT`` - 67 | * ``CREATED_DATE`` - 68 | * ``DATE_START`` - 69 | * ``DATE_STOP`` - 70 | * ``ID`` - 71 | * ``MINUTES`` - 72 | * ``SECONDS`` - 73 | * ``SOURCE`` - 74 | * ``TASK_ID`` - 75 | * ``USER_ID`` - 76 | 77 | 78 | **Example:** :: 79 | 80 | bx24.call('task.elapseditem.getlist', 81 | {'TASKID': 1682}, 82 | {'ORDER': {'ID': 'asc'}}, 83 | {'FILTER': {'USER_ID': 1, '>ID': 2}}) 84 | 85 | **Result:** :: 86 | 87 | {u'result': [{u'COMMENT_TEXT': u'Test description', 88 | u'CREATED_DATE': u'2016-08-01T00:00:00+03:00', 89 | u'DATE_START': u'2016-08-22T21:31:44+03:00', 90 | u'DATE_STOP': u'2016-08-22T21:31:44+03:00', 91 | u'ID': u'4', 92 | u'MINUTES': u'60', 93 | u'SECONDS': u'3600', 94 | u'SOURCE': u'2', 95 | u'TASK_ID': u'1682', 96 | u'USER_ID': u'1'}, 97 | ... 98 | ]} 99 | 100 | task.elapseditem.get 101 | -------------------- 102 | Returns an entry about the elapsed time for a task by its identifier. 103 | 104 | **Parameters:** 105 | 106 | * ```` - 107 | 108 | **Result fields:** 109 | 110 | * ```` - 111 | 112 | **Possible errors:** 113 | 114 | * ```` - 115 | 116 | 117 | **Example:** :: 118 | 119 | 120 | 121 | **Result:** :: 122 | 123 | 124 | task.elapseditem.add 125 | -------------------- 126 | Add time spent to the task. 127 | 128 | **Parameters:** 129 | 130 | * ```` - 131 | 132 | **Result fields:** 133 | 134 | * ```` - 135 | 136 | **Possible errors:** 137 | 138 | * ```` - 139 | 140 | 141 | **Example:** :: 142 | 143 | 144 | 145 | **Result:** :: 146 | 147 | 148 | task.elapseditem.delete 149 | ----------------------- 150 | Deletes the entry about elapsed time. 151 | 152 | **Parameters:** 153 | 154 | * ```` - 155 | 156 | **Result fields:** 157 | 158 | * ```` - 159 | 160 | **Possible errors:** 161 | 162 | * ```` - 163 | 164 | 165 | **Example:** :: 166 | 167 | 168 | 169 | **Result:** :: 170 | 171 | 172 | task.elapseditem.isactionallowed 173 | -------------------------------- 174 | Verify whether the action is allowed. 175 | 176 | **Parameters:** 177 | 178 | * ```` - 179 | 180 | **Result fields:** 181 | 182 | * ```` - 183 | 184 | **Possible errors:** 185 | 186 | * ```` - 187 | 188 | 189 | **Example:** :: 190 | 191 | 192 | 193 | **Result:** :: 194 | 195 | 196 | task.elapseditem.update 197 | ----------------------- 198 | Change parameters of the time spent record. 199 | 200 | **Parameters:** 201 | 202 | * ```` - 203 | 204 | **Result fields:** 205 | 206 | * ```` - 207 | 208 | **Possible errors:** 209 | 210 | * ```` - 211 | 212 | 213 | **Example:** :: 214 | 215 | 216 | 217 | **Result:** :: 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /docs/source/methods/task.checklistitem.rst: -------------------------------------------------------------------------------- 1 | Task checklist item Methods 2 | =========================== 3 | 4 | Provides work with check list elements in tasks. 5 | 6 | 7 | task.checklistitem.getmanifest 8 | ------------------------------ 9 | Returns the list of methods and their description. 10 | 11 | **Parameters:** 12 | 13 | * ```` - 14 | 15 | **Result fields:** 16 | 17 | * ```` - 18 | 19 | **Possible errors:** 20 | 21 | * ```` - 22 | 23 | **Example:** :: 24 | 25 | 26 | 27 | **Result:** :: 28 | 29 | 30 | 31 | task.checklistitem.getlist 32 | -------------------------- 33 | Returns the list of elements of check lists in a task. 34 | 35 | **Parameters:** 36 | 37 | * ``TASKID`` - Task identifier. Required parameter. 38 | * ``ORDER`` - The sorting field can take the following values: 39 | * ``ID`` – check list element identifier; 40 | * ``CREATED_BY`` – identifier of the user who has created the element; 41 | * ``TOGGLED_BY`` – identifier of the user who has modified the check list element status; 42 | * ``TOGGLED_DATE`` – the time when the check list element status was changed; 43 | * ``TITLE`` – check list element header; 44 | * ``SORT_INDEX`` – element sorting index; 45 | * ``IS_COMPLETE`` – the element is marked as completed; 46 | The sorting direction can take the following values: 47 | * ``asc`` – ascending; 48 | * ``desc`` – descending; 49 | Optional. By default it is filtered by descending identifier of a check list element. 50 | 51 | **Result fields:** 52 | 53 | * ``result`` - Checklist items list 54 | * ``CREATED_BY`` - 55 | * ``ID`` - 56 | * ``IS_COMPLETE`` - 57 | * ``SORT_INDEX`` - 58 | * ``TASK_ID`` - 59 | * ``TITLE`` - 60 | * ``TOGGLED_BY`` - 61 | * ``TOGGLED_DATE`` - 62 | 63 | **Example:** :: 64 | 65 | bx24.call('task.checklistitem.getlist', 66 | {'TASKID': 1682}, 67 | {'ORDER': {'ID': 'asc'}}) 68 | 69 | **Result:** :: 70 | 71 | {u'result': [{u'CREATED_BY': u'1', 72 | u'ID': u'2', 73 | u'IS_COMPLETE': u'N', 74 | u'SORT_INDEX': u'0', 75 | u'TASK_ID': u'1682', 76 | u'TITLE': u'Test item', 77 | u'TOGGLED_BY': None, 78 | u'TOGGLED_DATE': u''}, 79 | ... 80 | ]} 81 | 82 | 83 | task.checklistitem.get 84 | ---------------------- 85 | Returns a check list element by its identifier. 86 | 87 | **Parameters:** 88 | 89 | * ```` - 90 | 91 | **Result fields:** 92 | 93 | * ```` - 94 | 95 | **Possible errors:** 96 | 97 | * ```` - 98 | 99 | **Example:** :: 100 | 101 | 102 | 103 | **Result:** :: 104 | 105 | 106 | task.checklistitem.add 107 | ---------------------- 108 | Adds a new check list element to the task. 109 | 110 | **Parameters:** 111 | 112 | * ```` - 113 | 114 | **Result fields:** 115 | 116 | * ```` - 117 | 118 | **Possible errors:** 119 | 120 | * ```` - 121 | 122 | **Example:** :: 123 | 124 | 125 | 126 | **Result:** :: 127 | 128 | 129 | task.checklistitem.update 130 | ------------------------- 131 | 132 | Updates check list element data. 133 | 134 | **Parameters:** 135 | 136 | * ```` - 137 | 138 | **Result fields:** 139 | 140 | * ```` - 141 | 142 | **Possible errors:** 143 | 144 | * ```` - 145 | 146 | **Example:** :: 147 | 148 | 149 | **Result:** :: 150 | 151 | 152 | task.checklistitem.delete 153 | ------------------------- 154 | Deletes a check list element. 155 | 156 | **Parameters:** 157 | 158 | * ```` - 159 | 160 | **Result fields:** 161 | 162 | * ```` - 163 | 164 | **Possible errors:** 165 | 166 | * ```` - 167 | 168 | **Example:** :: 169 | 170 | 171 | 172 | **Result:** :: 173 | 174 | 175 | task.checklistitem.complete 176 | --------------------------- 177 | Marks a check list element as completed. 178 | 179 | **Parameters:** 180 | 181 | * ```` - 182 | 183 | **Result fields:** 184 | 185 | * ```` - 186 | 187 | **Possible errors:** 188 | 189 | * ```` - 190 | 191 | **Example:** :: 192 | 193 | 194 | 195 | **Result:** :: 196 | 197 | 198 | task.checklistitem.renew 199 | ------------------------ 200 | Marks a completed check list element as active again. 201 | 202 | **Parameters:** 203 | 204 | * ```` - 205 | 206 | **Result fields:** 207 | 208 | * ```` - 209 | 210 | **Possible errors:** 211 | 212 | * ```` - 213 | 214 | **Example:** :: 215 | 216 | 217 | 218 | **Result:** :: 219 | 220 | 221 | task.checklistitem.moveafteritem 222 | -------------------------------- 223 | Moves a check list element in the list and places it after the indicated one. 224 | 225 | **Parameters:** 226 | 227 | * ```` - 228 | 229 | **Result fields:** 230 | 231 | * ```` - 232 | 233 | **Possible errors:** 234 | 235 | * ```` - 236 | 237 | **Example:** :: 238 | 239 | 240 | 241 | **Result:** :: 242 | 243 | 244 | task.checklistitem.isactionallowed 245 | ---------------------------------- 246 | Checks if an action is permitted for a check list element. 247 | 248 | **Parameters:** 249 | 250 | * ```` - 251 | 252 | **Result fields:** 253 | 254 | * ```` - 255 | 256 | **Possible errors:** 257 | 258 | * ```` - 259 | 260 | **Example:** :: 261 | 262 | 263 | 264 | **Result:** :: 265 | 266 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /docs/source/methods/user.rst: -------------------------------------------------------------------------------- 1 | User Methods 2 | ============ 3 | 4 | User Methods 5 | 6 | 7 | user.fields 8 | ----------- 9 | 10 | List user field names. 11 | 12 | **Result fields:** 13 | 14 | List user fields names 15 | 16 | 17 | **Example:** :: 18 | 19 | bx24.call('user.fields') 20 | 21 | 22 | **Result:** :: 23 | 24 | {u'result': {u'ACTIVE': u'Active', 25 | u'EMAIL': u'E-mail', 26 | u'ID': u'ID', 27 | u'LAST_NAME': u'Last name', 28 | u'NAME': u'First name', 29 | u'PERSONAL_BIRTHDAY': u'Date of birth', 30 | u'PERSONAL_CITY': u'City', 31 | u'PERSONAL_COUNTRY': u'Country', 32 | u'PERSONAL_FAX': u'Fax', 33 | u'PERSONAL_GENDER': u'Sex', 34 | u'PERSONAL_ICQ': u'ICQ', 35 | u'PERSONAL_MOBILE': u'Private cellular', 36 | u'PERSONAL_PAGER': u'Pager', 37 | u'PERSONAL_PHONE': u'Private phone', 38 | u'PERSONAL_PHOTO': u'Photo', 39 | u'PERSONAL_PROFESSION': u'Job title', 40 | u'PERSONAL_STATE': u'State', 41 | u'PERSONAL_STREET': u'Street', 42 | u'PERSONAL_WWW': u'Home page', 43 | u'PERSONAL_ZIP': u'Zip', 44 | u'SECOND_NAME': u'Middle name', 45 | u'UF_DEPARTMENT': u'Departments', 46 | u'UF_DISTRICT': u'District', 47 | u'UF_FACEBOOK': u'Facebook', 48 | u'UF_INTERESTS': u'Interests', 49 | u'UF_LINKEDIN': u'LinkedIn', 50 | u'UF_PHONE_INNER': u'Extension number', 51 | u'UF_SKILLS': u'Skills', 52 | u'UF_SKYPE': u'Skype', 53 | u'UF_TWITTER': u'Twitter', 54 | u'UF_WEB_SITES': u'Other websites', 55 | u'UF_XING': u'Xing', 56 | u'WORK_COMPANY': u'Company', 57 | u'WORK_PHONE': u'Company phone', 58 | u'WORK_POSITION': u'Position'}} 59 | 60 | 61 | user.current 62 | ------------ 63 | 64 | Retrieve current user information. 65 | 66 | 67 | **Result fields:** 68 | 69 | List user fields values 70 | 71 | 72 | **Example:** :: 73 | 74 | bx24.call('user.current') 75 | 76 | 77 | **Result:** :: 78 | 79 | {u'result': {u'ACTIVE': True, 80 | u'EMAIL': u'user@example.com', 81 | u'ID': u'1', 82 | u'LAST_NAME': u'Test', 83 | u'NAME': u'User', 84 | u'PERSONAL_BIRTHDAY': u'', 85 | u'PERSONAL_CITY': None, 86 | u'PERSONAL_COUNTRY': None, 87 | u'PERSONAL_FAX': None, 88 | u'PERSONAL_GENDER': u'', 89 | u'PERSONAL_ICQ': None, 90 | u'PERSONAL_MOBILE': None, 91 | u'PERSONAL_PAGER': None, 92 | u'PERSONAL_PHONE': None, 93 | u'PERSONAL_PHOTO': None, 94 | u'PERSONAL_PROFESSION': None, 95 | u'PERSONAL_STATE': None, 96 | u'PERSONAL_STREET': None, 97 | u'PERSONAL_WWW': None, 98 | u'PERSONAL_ZIP': None, 99 | u'SECOND_NAME': None, 100 | u'UF_DEPARTMENT': [1], 101 | u'UF_DISTRICT': None, 102 | u'UF_FACEBOOK': None, 103 | u'UF_INTERESTS': None, 104 | u'UF_LINKEDIN': None, 105 | u'UF_PHONE_INNER': None, 106 | u'UF_SKILLS': None, 107 | u'UF_SKYPE': None, 108 | u'UF_TWITTER': None, 109 | u'UF_WEB_SITES': None, 110 | u'UF_XING': None, 111 | u'WORK_COMPANY': None, 112 | u'WORK_PHONE': None, 113 | u'WORK_POSITION': None}} 114 | 115 | 116 | user.add 117 | -------- 118 | 119 | Invite user. 120 | 121 | **Parameters:** 122 | 123 | * ``EMAIL`` - User email for send invite 124 | 125 | **Result fields:** 126 | 127 | User id 128 | 129 | **Possible errors:** 130 | 131 | * A user with e-mail ``email`` already exists. 132 | 133 | 134 | **Example:** :: 135 | 136 | bx24.call('user.add', {'EMAIL': 'user@example.com'}) 137 | 138 | **Result:** :: 139 | 140 | {u'result': 6} 141 | 142 | user.update 143 | ----------- 144 | 145 | Update user information. 146 | 147 | **Parameters:** 148 | 149 | * ``ID`` - User id. Field is required 150 | * ``users.fields`` - Any ``user.fields`` except ``ID`` and ``EMAIL`` 151 | 152 | **Possible errors:** 153 | 154 | * Invalid file type for field PERSONAL_PHOTO // TODO Example update photo 155 | 156 | **Example:** :: 157 | 158 | bx24.call('user.update', {'ID': 1, 'NAME': 'Another name'}) 159 | 160 | **Result:** :: 161 | 162 | {u'result': True} 163 | 164 | 165 | user.get 166 | -------- 167 | 168 | List filtered users. 169 | 170 | **Parameters:** 171 | 172 | * ``sort`` - Sorted-by field 173 | * ``order`` - Sort order: ``ASC`` - ascending, ``DESC`` - descending 174 | * ``users.fields`` - In addition, any ``user.fields`` parameters may be used as filter. 175 | 176 | **Result fields:** 177 | 178 | List of users 179 | 180 | 181 | **Example:** :: 182 | 183 | bx24.call('user.get', {'sort': 'ID', 'order': 'DESC', 'EMAIL': '%@example.com%'}) 184 | 185 | 186 | **Result:** :: 187 | 188 | {u'result': [{u'ACTIVE': True, 189 | u'EMAIL': u'user60@example.com', 190 | u'ID': u'60', 191 | u'LAST_NAME': 'Test', 192 | u'NAME': 'User60', 193 | u'PERSONAL_BIRTHDAY': u'', 194 | u'PERSONAL_CITY': None, 195 | u'PERSONAL_COUNTRY': None, 196 | u'PERSONAL_FAX': None, 197 | u'PERSONAL_GENDER': u'', 198 | u'PERSONAL_ICQ': None, 199 | u'PERSONAL_MOBILE': None, 200 | u'PERSONAL_PAGER': None, 201 | u'PERSONAL_PHONE': None, 202 | u'PERSONAL_PHOTO': None, 203 | u'PERSONAL_PROFESSION': None, 204 | u'PERSONAL_STATE': None, 205 | u'PERSONAL_STREET': None, 206 | u'PERSONAL_WWW': None, 207 | u'PERSONAL_ZIP': None, 208 | u'SECOND_NAME': None, 209 | u'UF_DEPARTMENT': False, 210 | u'UF_DISTRICT': None, 211 | u'UF_FACEBOOK': None, 212 | u'UF_INTERESTS': None, 213 | u'UF_LINKEDIN': None, 214 | u'UF_PHONE_INNER': None, 215 | u'UF_SKILLS': None, 216 | u'UF_SKYPE': None, 217 | u'UF_TWITTER': None, 218 | u'UF_WEB_SITES': None, 219 | u'UF_XING': None, 220 | u'WORK_COMPANY': None, 221 | u'WORK_PHONE': None, 222 | u'WORK_POSITION': None}, 223 | ... 224 | ], 225 | u'total': 50} 226 | 227 | -------------------------------------------------------------------------------- /bitrix24/bitrix24.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """Wrapper over Bitrix24 cloud API""" 4 | 5 | from json import loads 6 | from logging import info 7 | from time import sleep 8 | from requests import adapters, post, exceptions 9 | from multidimensional_urlencode import urlencode 10 | import urllib.parse 11 | 12 | # Retries for API request 13 | adapters.DEFAULT_RETRIES = 10 14 | 15 | 16 | class Bitrix24(object): 17 | """Class for working with Bitrix24 cloud API""" 18 | # Bitrix24 API endpoint 19 | api_url = 'https://%s/rest/%s.json' 20 | # Bitrix24 oauth server 21 | oauth_url = 'https://oauth.bitrix.info/oauth/token/' 22 | # Timeout for API request in seconds 23 | timeout = 60 24 | 25 | def __init__(self, domain, auth_token, refresh_token='', client_id='', client_secret=''): 26 | """Create Bitrix24 API object 27 | :param domain: str Bitrix24 domain 28 | :param auth_token: str Auth token 29 | :param refresh_token: str Refresh token 30 | :param client_id: str Client ID for refreshing access tokens 31 | :param client_secret: str Client secret for refreshing access tokens 32 | """ 33 | self.domain = domain 34 | self.auth_token = auth_token 35 | self.refresh_token = refresh_token 36 | self.client_id = client_id 37 | self.client_secret = client_secret 38 | 39 | def call(self, method, params1=None, params2=None, params3=None, params4=None): 40 | """Call Bitrix24 API method 41 | :param method: Method name 42 | :param params1: Method parameters 1 43 | :param params2: Method parameters 2. Needed for methods with determinate consequence of parameters 44 | :param params3: Method parameters 3. Needed for methods with determinate consequence of parameters 45 | :param params4: Method parameters 4. Needed for methods with determinate consequence of parameters 46 | :return: Call result 47 | """ 48 | if method == '' or not isinstance(method, str): 49 | raise Exception('Empty Method') 50 | 51 | if method == 'batch' and 'prepared' not in params1: 52 | params1['cmd'] = self.prepare_batch(params1['cmd']) 53 | params1['prepared'] = True 54 | 55 | encoded_parameters = '' 56 | 57 | for i in [params1, params2, params3, params4, {'auth': self.auth_token}]: 58 | if i is not None: 59 | if 'cmd' in i: 60 | i = dict(i) 61 | encoded_parameters += self.encode_cmd(i['cmd']) + '&' + urlencode({'halt': i['halt']}) + '&' 62 | else: 63 | encoded_parameters += self.http_build_query(i) + '&' 64 | 65 | r = {} 66 | 67 | try: 68 | # request url 69 | url = self.api_url % (self.domain, method) 70 | # Make API request 71 | r = post(url, data=encoded_parameters, timeout=self.timeout) 72 | # Decode response 73 | result = loads(r.text) 74 | except ValueError: 75 | result = dict(error='Error on decode api response [%s]' % r.text) 76 | except exceptions.ReadTimeout: 77 | result = dict(error='Timeout waiting expired [%s sec]' % str(self.timeout)) 78 | except exceptions.ConnectionError: 79 | result = dict(error='Max retries exceeded [' + str(adapters.DEFAULT_RETRIES) + ']') 80 | if 'error' in result and result['error'] in ('NO_AUTH_FOUND', 'expired_token'): 81 | result = self.refresh_tokens() 82 | if result is not True: 83 | return result 84 | # Repeat API request after renew token 85 | result = self.call(method, params1, params2, params3, params4) 86 | elif result.get('error_description', ''): 87 | print(result.get('error_description')) 88 | return result 89 | elif 'error' in result and result['error'] in 'QUERY_LIMIT_EXCEEDED': 90 | # Suspend call on two second, wait for expired limitation time by Bitrix24 API 91 | print 'SLEEP =)' 92 | sleep(2) 93 | return self.call(method, params1, params2, params3, params4) 94 | return result 95 | 96 | # https://stackoverflow.com/a/39082010/12354388 97 | def http_build_query(self, data): 98 | parents = list() 99 | pairs = dict() 100 | 101 | def renderKey(parents): 102 | depth, outStr = 0, '' 103 | for x in parents: 104 | s = "[%s]" if depth > 0 or isinstance(x, int) else "%s" 105 | outStr += s % str(x) 106 | depth += 1 107 | return outStr 108 | 109 | def r_urlencode(data): 110 | if isinstance(data, list) or isinstance(data, tuple): 111 | for i in range(len(data)): 112 | parents.append(i) 113 | r_urlencode(data[i]) 114 | parents.pop() 115 | elif isinstance(data, dict): 116 | for key, value in data.items(): 117 | parents.append(key) 118 | r_urlencode(value) 119 | parents.pop() 120 | else: 121 | pairs[renderKey(parents)] = str(data) 122 | 123 | return pairs 124 | 125 | return urllib.parse.urlencode(r_urlencode(data)) 126 | 127 | def refresh_tokens(self): 128 | """Refresh access tokens 129 | :return: 130 | """ 131 | r = {} 132 | try: 133 | # Make call to oauth server 134 | r = post( 135 | self.oauth_url, 136 | params={'grant_type': 'refresh_token', 'client_id': self.client_id, 'client_secret': self.client_secret, 137 | 'refresh_token': self.refresh_token}) 138 | result = loads(r.text) 139 | # Renew access tokens 140 | self.auth_token = result['access_token'] 141 | self.refresh_token = result['refresh_token'] 142 | info(['Tokens', self.auth_token, self.refresh_token]) 143 | return True 144 | except (ValueError, KeyError): 145 | result = dict(error='Error on decode oauth response [%s]' % r.text) 146 | return result 147 | 148 | def get_tokens(self): 149 | """Get access tokens 150 | :return: dict 151 | """ 152 | return {'auth_token': self.auth_token, 'refresh_token': self.refresh_token} 153 | 154 | @staticmethod 155 | def prepare_batch(params): 156 | """ 157 | Prepare methods for batch call 158 | :param params: dict 159 | :return: dict 160 | """ 161 | if not isinstance(params, dict): 162 | raise Exception('Invalid \'cmd\' structure') 163 | 164 | batched_params = dict() 165 | 166 | for call_id in sorted(params.keys()): 167 | if not isinstance(params[call_id], list): 168 | raise Exception('Invalid \'cmd\' method description') 169 | method = params[call_id].pop(0) 170 | if method == 'batch': 171 | raise Exception('Batch call cannot contain batch methods') 172 | temp = '' 173 | for i in params[call_id]: 174 | temp += urlencode(i) + '&' 175 | batched_params[call_id] = method + '?' + temp 176 | 177 | return batched_params 178 | 179 | @staticmethod 180 | def encode_cmd(cmd): 181 | """Resort batch cmd by request keys and encode it 182 | :param cmd: dict List methods for batch request with request ids 183 | :return: str 184 | """ 185 | cmd_encoded = '' 186 | 187 | for i in sorted(cmd.keys()): 188 | cmd_encoded += urlencode({'cmd': {i: cmd[i]}}) + '&' 189 | 190 | return cmd_encoded 191 | 192 | def batch(self, params): 193 | """Batch calling without limits. Method automatically prepare method for batch calling 194 | :param params: 195 | :return: 196 | """ 197 | if 'halt' not in params or 'cmd' not in params: 198 | return dict(error='Invalid batch structure') 199 | 200 | result = dict() 201 | 202 | result['result'] = dict( 203 | result_error={}, 204 | result_total={}, 205 | result={}, 206 | result_next={}, 207 | ) 208 | count = 0 209 | batch = dict() 210 | for request_id in sorted(params['cmd'].keys()): 211 | batch[request_id] = params['cmd'][request_id] 212 | count += 1 213 | if len(batch) == 49 or count == len(params['cmd']): 214 | temp = self.call('batch', {'halt': params['halt'], 'cmd': batch}) 215 | for i in temp['result']: 216 | if len(temp['result'][i]) > 0: 217 | result['result'][i] = self.merge_two_dicts(temp['result'][i], result['result'][i]) 218 | batch = dict() 219 | 220 | return result 221 | 222 | @staticmethod 223 | def merge_two_dicts(x, y): 224 | """Given two dicts, merge them into a new dict as a shallow copy.""" 225 | z = x.copy() 226 | z.update(y) 227 | return z 228 | -------------------------------------------------------------------------------- /docs/source/methods/common.rst: -------------------------------------------------------------------------------- 1 | Common REST Methods 2 | =================== 3 | 4 | The following methods are available to all applications irrespective of the current application permissions. 5 | 6 | methods 7 | ------- 8 | Returns all methods or those available to a current application. 9 | 10 | **Parameters:** 11 | 12 | * ``scope`` - Specifies the scope name. This parameter is optional. 13 | 14 | **Example:** :: 15 | 16 | bx24.call('methods') 17 | 18 | **Result:** :: 19 | 20 | {u'result': [u'batch', u'scope', u'methods', u'events', ...]} 21 | 22 | 23 | Returns methods available to scope. :: 24 | 25 | >>> bx24.call('methods', {'scope':'user'}) 26 | >>> {u'result': [u'user.fields', u'user.current', u'user.get', ...]} 27 | 28 | 29 | If the scope name is omitted , all the common methods are returned. :: 30 | 31 | >>> bx24.call('methods', {'scope':''}) 32 | >>> {u'result': [u'batch', u'scope', u'methods', u'events', ...]} 33 | 34 | scope 35 | ----- 36 | Returns all permissions or only those available to a current application. 37 | 38 | **Parameters:** 39 | 40 | * ``full`` - If ``True`` method return a list of all scopess. This parameter is optional. 41 | 42 | **Example:** :: 43 | 44 | bx24.call('scope') 45 | 46 | **Result:** :: 47 | 48 | {u'result': [u'task', u'tasks_extended']} 49 | 50 | Return a list of all scopes. :: 51 | 52 | >>> bx24.call('scope', {'full': True}) 53 | >>> {u'result': [u'calendar', u'disk', u'telephony', u'lists', ... ]} 54 | 55 | app.info 56 | -------- 57 | Displays application information. 58 | 59 | **Result fields:** 60 | 61 | * ``ID`` - Application local id 62 | * ``CODE`` - Specifies the application ID. 63 | * ``LANGUAGE_ID`` - Current language. 64 | * ``VERSION`` - Specifies the application version. 65 | * ``STATUS`` - The application status. It can be one of the following values: 66 | * ``F`` - free; 67 | * ``D`` - demo version; 68 | * ``T`` - trial version, time limited; 69 | * ``P`` - the application has been purchased. 70 | * ``PAYMENT_EXPIRED`` - if Y, the application license or trial period has expired. 71 | * ``DAY`` - Specifies the number of days left until the application license or trial period expires. 72 | 73 | **Example:** :: 74 | 75 | bx24.call('app.info') 76 | 77 | **Result:** :: 78 | 79 | { 80 | u'result': 81 | { 82 | u'CODE': u'local.1234567890abcd.12345678', 83 | u'DAYS': None, 84 | u'ID': u'2', 85 | u'LANGUAGE_ID': u'ru', 86 | u'LICENSE': u'ru_project', 87 | u'PAYMENT_EXPIRED': u'N', 88 | u'STATUS': u'L', 89 | u'VERSION': 1 90 | } 91 | } 92 | 93 | user.admin 94 | ---------- 95 | Checks if a current user has sufficient permission to manage application parameters. 96 | 97 | **Example:** :: 98 | 99 | bx24.call('user.admin') 100 | 101 | **Result:** :: 102 | 103 | {u'result': True} 104 | 105 | user.access 106 | ----------- 107 | Checks if a current user has at least one permission of those specified as an argument. 108 | 109 | **Parameters:** 110 | 111 | * ``ACCESS`` - The ID or a list of ID's of permissions to be checked. This parameter is required. 112 | 113 | **Example:** :: 114 | 115 | bx24.call('user.access', {'ACCESS': 'UA'}) 116 | 117 | **Result:** :: 118 | 119 | {u'result': True} 120 | 121 | 122 | access.name 123 | ----------- 124 | Returns a human readable name of an access permission. 125 | 126 | **Parameters:** 127 | 128 | * ``ACCESS`` - Specifies the access permissions whose names are to be returned. This parameter is required. 129 | 130 | **Result fields:** 131 | 132 | * ``name`` - Human readable permission name 133 | * ``provider`` - `unknown`. 134 | * ``provider_id`` - `unknown`. 135 | 136 | **Example:** :: 137 | 138 | bx24.call('access.name', {'ACCESS': {0: 'AU'}}) 139 | 140 | **Result:** :: 141 | 142 | {u'result': {u'AU': {u'name': u'All authorized users', 143 | u'provider': u'', 144 | u'provider_id': u'other'}}} 145 | 146 | 147 | events 148 | ------ 149 | Retrieves a list of all authorized events. 150 | 151 | **Example:** :: 152 | 153 | bx24.call('events') 154 | 155 | **Result:** :: 156 | 157 | {u'result': [u'ONAPPUNINSTALL', 158 | u'ONAPPINSTALL', 159 | u'ONAPPUPDATE', 160 | u'ONAPPPAYMENT', 161 | u'ONAPPTEST', 162 | u'ONTASKADD', 163 | u'ONTASKUPDATE', 164 | u'ONTASKDELETE', 165 | u'ONTASKCOMMENTADD', 166 | u'ONTASKCOMMENTUPDATE', 167 | u'ONTASKCOMMENTDELETE']} 168 | 169 | 170 | Return events for a scope :: 171 | 172 | bx24.call('events', {'scope': 'task'}) 173 | 174 | Result: :: 175 | 176 | {u'result': [u'ONTASKADD', 177 | u'ONTASKUPDATE', 178 | u'ONTASKDELETE', 179 | u'ONTASKCOMMENTADD', 180 | u'ONTASKCOMMENTUPDATE', 181 | u'ONTASKCOMMENTDELETE']} 182 | 183 | 184 | event.bind 185 | ---------- 186 | Installs a new event handler. The method can be called only by a user having administrative privileges. 187 | 188 | **Parameters:** 189 | 190 | * ``event`` - Specifies the event name. This parameter is required. 191 | * ``handler`` - Specifies the event handler URL. This parameter is required. 192 | * ``auth_type`` - Specifies the ID of a user whose credentials will be used to install the handler. This parameter is optional. By default, the event handler will be authenticated as a user whose actions triggered the event. 193 | 194 | **Example:** :: 195 | 196 | bx24.call('event.bind', 197 | {'event': 'ONAPPUNINSTALL', 198 | 'handler': 'https://example.com/handler.py', 199 | 'auth_type': 0 200 | }) 201 | 202 | **Result:** :: 203 | 204 | {u'result': True} 205 | 206 | 207 | **Possible errors:** 208 | * Unable to set event handler: Handler already binded 209 | * Handler URL host doesn't match application url 210 | 211 | 212 | event.unbind 213 | ------------ 214 | 215 | Uninstalls a previously installed event handler. The method can be called only by a user having administrative privileges. 216 | 217 | **Parameters:** 218 | 219 | * ``event`` - Specifies the event name. This parameter is optional. 220 | * ``handler`` - Specifies the event handler URL. This parameter is optional. 221 | * ``auth_type`` - Specifies the ID of a user whose credentials will be used to install the handler. This parameter is optional. Notice: to remove an event handler installed with an empty auth_type (which means a user whose actions triggered the event) but remain other handlers active, specify auth_type=0 or empty value. 222 | 223 | **Result fields:** 224 | 225 | * ``count`` - Counter of removed event handlers 226 | 227 | **Example:** :: 228 | 229 | bx24.call('event.unbind', 230 | {'event': 'ONAPPUNINSTALL', 231 | 'handler': 'https://example.com/handler.py', 232 | 'auth_type': 0 233 | }) 234 | 235 | **Result:** :: 236 | 237 | {u'result': {u'count': 1}} 238 | 239 | 240 | event.get 241 | --------- 242 | Get the list of registered event handlers. 243 | 244 | **Result fields:** 245 | 246 | * ``event`` - Event name. This parameter is optional. 247 | * ``handler`` - Event handler URL. 248 | * ``auth_type`` - ID of a user whose credentials will be used to install the handler. 249 | 250 | **Example:** :: 251 | 252 | bx24.call('event.get') 253 | 254 | **Result:** :: 255 | 256 | {u'result': [{u'auth_type': u'0', 257 | u'handler': u'https://example.com/handler.py', 258 | u'event': u'ONAPPUNINSTALL'}]} 259 | 260 | batch 261 | ----- 262 | Executes requests in a batch. 263 | It is not uncommon for an application to send requests in series. Use this function to batch call REST methods instead of sending requests one by one. 264 | 265 | **Parameters:** 266 | 267 | * ``halt`` - If 1, the batch will be aborted if an error occurs. If 0 (zero), all the requests will be passed to REST service regardless of errors. 268 | * ``cmd`` - Specifies a standard array of requests. Notice that the request data must be quoted; therefore, the request data inside a request must be quoted again. 269 | 270 | **Result fields:** 271 | 272 | * ``result`` - Requests results 273 | * ``result_error`` - Requests with errors 274 | * ``result_next`` - A number that needs to be sent to get the next page of data 275 | * ``result_total`` - The number of records in response (for methods that return data in chunks or pages) for next request 276 | 277 | **Example:** :: 278 | 279 | bx24.call('batch', { 280 | 'halt': 0, 281 | 'cmd': { 282 | # Simple method 283 | 'r0': ['app.info'], 284 | 285 | # Method with params 286 | 'r1': ['methods', {'scope': 'task'}], 287 | 288 | # Method where order of parameters is important 289 | 'r3': ['task.item.list', 290 | {'ORDER': {'GROUP_ID': 'asc'}}, 291 | {'FILTER': {'GROUP_ID': 12}}, 292 | {'PARAMS': {}}] 293 | } 294 | }) 295 | 296 | **Result:** :: 297 | 298 | {u'result': {u'result': {u'r0':[u'task.ctaskitem.getmanifest', 299 | u'task.item.getmanifest', 300 | u'task.ctaskitem.getlist', 301 | u'task.item.getlist', 302 | u'task.ctaskitem.list', 303 | ... 304 | ], 305 | u'r1': {u'CODE': u'local.12345678901234.12345678', 306 | u'DAYS': None, 307 | u'ID': u'22', 308 | u'LANGUAGE_ID': u'ru', 309 | u'LICENSE': u'ru_project', 310 | u'PAYMENT_EXPIRED': u'N', 311 | u'STATUS': u'L', 312 | u'VERSION': 1}, 313 | u'r2': [{u'ACCOMPLICES': [], 314 | u'ADD_IN_REPORT': u'N', 315 | u'GROUP_ID': u'12', 316 | u'GUID': u'{b89aa5d7-0bea-4588-919b-a08e6059dd14}', 317 | u'ID': u'32', 318 | u'REAL_STATUS': u'2', 319 | u'TITLE': u'Some task title', 320 | ...}, 321 | ... 322 | ]}, 323 | u'result_error': [], 324 | u'result_next': [], 325 | u'result_total': {u'r2': 6}}} 326 | 327 | Possible errors: 328 | * Invalid 'cmd' structure 329 | * Invalid 'cmd' method description -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # bitrix24-python-sdk documentation build configuration file, created by 4 | # sphinx-quickstart on Wed Aug 17 22:27:41 2016. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | # If extensions (or modules to document with autodoc) are in another directory, 16 | # add these directories to sys.path here. If the directory is relative to the 17 | # documentation root, use os.path.abspath to make it absolute, like shown here. 18 | # 19 | # import os 20 | # import sys 21 | # sys.path.insert(0, os.path.abspath('.')) 22 | 23 | # -- General configuration ------------------------------------------------ 24 | 25 | # If your documentation needs a minimal Sphinx version, state it here. 26 | # 27 | # needs_sphinx = '1.0' 28 | 29 | # Add any Sphinx extension module names here, as strings. They can be 30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 31 | # ones. 32 | extensions = [] 33 | 34 | # Add any paths that contain templates here, relative to this directory. 35 | templates_path = ['_templates'] 36 | 37 | # The suffix(es) of source filenames. 38 | # You can specify multiple suffix as a list of string: 39 | # 40 | # source_suffix = ['.rst', '.md'] 41 | source_suffix = '.rst' 42 | 43 | # The encoding of source files. 44 | # 45 | # source_encoding = 'utf-8-sig' 46 | 47 | # The master toctree document. 48 | master_doc = 'index' 49 | 50 | # General information about the project. 51 | project = u'bitrix24-python-sdk' 52 | copyright = u'2016, Vladislav Sikach' 53 | author = u'Vladislav Sikach' 54 | 55 | # The version info for the project you're documenting, acts as replacement for 56 | # |version| and |release|, also used in various other places throughout the 57 | # built documents. 58 | # 59 | # The short X.Y version. 60 | version = u'1.0.1' 61 | # The full version, including alpha/beta/rc tags. 62 | release = u'1.0.1' 63 | 64 | # The language for content autogenerated by Sphinx. Refer to documentation 65 | # for a list of supported languages. 66 | # 67 | # This is also used if you do content translation via gettext catalogs. 68 | # Usually you set "language" from the command line for these cases. 69 | language = None 70 | 71 | # There are two options for replacing |today|: either, you set today to some 72 | # non-false value, then it is used: 73 | # 74 | # today = '' 75 | # 76 | # Else, today_fmt is used as the format for a strftime call. 77 | # 78 | # today_fmt = '%B %d, %Y' 79 | 80 | # List of patterns, relative to source directory, that match files and 81 | # directories to ignore when looking for source files. 82 | # This patterns also effect to html_static_path and html_extra_path 83 | exclude_patterns = [] 84 | 85 | # The reST default role (used for this markup: `text`) to use for all 86 | # documents. 87 | # 88 | # default_role = None 89 | 90 | # If true, '()' will be appended to :func: etc. cross-reference text. 91 | # 92 | # add_function_parentheses = True 93 | 94 | # If true, the current module name will be prepended to all description 95 | # unit titles (such as .. function::). 96 | # 97 | # add_module_names = True 98 | 99 | # If true, sectionauthor and moduleauthor directives will be shown in the 100 | # output. They are ignored by default. 101 | # 102 | # show_authors = False 103 | 104 | # The name of the Pygments (syntax highlighting) style to use. 105 | pygments_style = 'sphinx' 106 | 107 | # A list of ignored prefixes for module index sorting. 108 | # modindex_common_prefix = [] 109 | 110 | # If true, keep warnings as "system message" paragraphs in the built documents. 111 | # keep_warnings = False 112 | 113 | # If true, `todo` and `todoList` produce output, else they produce nothing. 114 | todo_include_todos = False 115 | 116 | 117 | # -- Options for HTML output ---------------------------------------------- 118 | 119 | # The theme to use for HTML and HTML Help pages. See the documentation for 120 | # a list of builtin themes. 121 | # 122 | html_theme = 'alabaster' 123 | 124 | # Theme options are theme-specific and customize the look and feel of a theme 125 | # further. For a list of options available for each theme, see the 126 | # documentation. 127 | # 128 | # html_theme_options = {} 129 | 130 | # Add any paths that contain custom themes here, relative to this directory. 131 | # html_theme_path = [] 132 | 133 | # The name for this set of Sphinx documents. 134 | # " v documentation" by default. 135 | # 136 | # html_title = u'bitrix24-python-sdk v1.0.1' 137 | 138 | # A shorter title for the navigation bar. Default is the same as html_title. 139 | # 140 | # html_short_title = None 141 | 142 | # The name of an image file (relative to this directory) to place at the top 143 | # of the sidebar. 144 | # 145 | # html_logo = None 146 | 147 | # The name of an image file (relative to this directory) to use as a favicon of 148 | # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 149 | # pixels large. 150 | # 151 | # html_favicon = None 152 | 153 | # Add any paths that contain custom static files (such as style sheets) here, 154 | # relative to this directory. They are copied after the builtin static files, 155 | # so a file named "default.css" will overwrite the builtin "default.css". 156 | html_static_path = ['_static'] 157 | 158 | # Add any extra paths that contain custom files (such as robots.txt or 159 | # .htaccess) here, relative to this directory. These files are copied 160 | # directly to the root of the documentation. 161 | # 162 | # html_extra_path = [] 163 | 164 | # If not None, a 'Last updated on:' timestamp is inserted at every page 165 | # bottom, using the given strftime format. 166 | # The empty string is equivalent to '%b %d, %Y'. 167 | # 168 | # html_last_updated_fmt = None 169 | 170 | # If true, SmartyPants will be used to convert quotes and dashes to 171 | # typographically correct entities. 172 | # 173 | # html_use_smartypants = True 174 | 175 | # Custom sidebar templates, maps document names to template names. 176 | # 177 | # html_sidebars = {} 178 | 179 | # Additional templates that should be rendered to pages, maps page names to 180 | # template names. 181 | # 182 | # html_additional_pages = {} 183 | 184 | # If false, no module index is generated. 185 | # 186 | # html_domain_indices = True 187 | 188 | # If false, no index is generated. 189 | # 190 | # html_use_index = True 191 | 192 | # If true, the index is split into individual pages for each letter. 193 | # 194 | # html_split_index = False 195 | 196 | # If true, links to the reST sources are added to the pages. 197 | # 198 | # html_show_sourcelink = True 199 | 200 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 201 | # 202 | # html_show_sphinx = True 203 | 204 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 205 | # 206 | # html_show_copyright = True 207 | 208 | # If true, an OpenSearch description file will be output, and all pages will 209 | # contain a tag referring to it. The value of this option must be the 210 | # base URL from which the finished HTML is served. 211 | # 212 | # html_use_opensearch = '' 213 | 214 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 215 | # html_file_suffix = None 216 | 217 | # Language to be used for generating the HTML full-text search index. 218 | # Sphinx supports the following languages: 219 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 220 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' 221 | # 222 | # html_search_language = 'en' 223 | 224 | # A dictionary with options for the search language support, empty by default. 225 | # 'ja' uses this config value. 226 | # 'zh' user can custom change `jieba` dictionary path. 227 | # 228 | # html_search_options = {'type': 'default'} 229 | 230 | # The name of a javascript file (relative to the configuration directory) that 231 | # implements a search results scorer. If empty, the default will be used. 232 | # 233 | # html_search_scorer = 'scorer.js' 234 | 235 | # Output file base name for HTML help builder. 236 | htmlhelp_basename = 'bitrix24-python-sdkdoc' 237 | 238 | # -- Options for LaTeX output --------------------------------------------- 239 | 240 | latex_elements = { 241 | # The paper size ('letterpaper' or 'a4paper'). 242 | # 243 | # 'papersize': 'letterpaper', 244 | 245 | # The font size ('10pt', '11pt' or '12pt'). 246 | # 247 | # 'pointsize': '10pt', 248 | 249 | # Additional stuff for the LaTeX preamble. 250 | # 251 | # 'preamble': '', 252 | 253 | # Latex figure (float) alignment 254 | # 255 | # 'figure_align': 'htbp', 256 | } 257 | 258 | # Grouping the document tree into LaTeX files. List of tuples 259 | # (source start file, target name, title, 260 | # author, documentclass [howto, manual, or own class]). 261 | latex_documents = [ 262 | (master_doc, 'bitrix24-python-sdk.tex', u'bitrix24-python-sdk Documentation', 263 | u'Vladislav Sikach', 'manual'), 264 | ] 265 | 266 | # The name of an image file (relative to this directory) to place at the top of 267 | # the title page. 268 | # 269 | # latex_logo = None 270 | 271 | # For "manual" documents, if this is true, then toplevel headings are parts, 272 | # not chapters. 273 | # 274 | # latex_use_parts = False 275 | 276 | # If true, show page references after internal links. 277 | # 278 | # latex_show_pagerefs = False 279 | 280 | # If true, show URL addresses after external links. 281 | # 282 | # latex_show_urls = False 283 | 284 | # Documents to append as an appendix to all manuals. 285 | # 286 | # latex_appendices = [] 287 | 288 | # It false, will not define \strong, \code, itleref, \crossref ... but only 289 | # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added 290 | # packages. 291 | # 292 | # latex_keep_old_macro_names = True 293 | 294 | # If false, no module index is generated. 295 | # 296 | # latex_domain_indices = True 297 | 298 | 299 | # -- Options for manual page output --------------------------------------- 300 | 301 | # One entry per manual page. List of tuples 302 | # (source start file, name, description, authors, manual section). 303 | man_pages = [ 304 | (master_doc, 'bitrix24-python-sdk', u'bitrix24-python-sdk Documentation', 305 | [author], 1) 306 | ] 307 | 308 | # If true, show URL addresses after external links. 309 | # 310 | # man_show_urls = False 311 | 312 | 313 | # -- Options for Texinfo output ------------------------------------------- 314 | 315 | # Grouping the document tree into Texinfo files. List of tuples 316 | # (source start file, target name, title, author, 317 | # dir menu entry, description, category) 318 | texinfo_documents = [ 319 | (master_doc, 'bitrix24-python-sdk', u'bitrix24-python-sdk Documentation', 320 | author, 'bitrix24-python-sdk', 'One line description of project.', 321 | 'Miscellaneous'), 322 | ] 323 | 324 | # Documents to append as an appendix to all manuals. 325 | # 326 | # texinfo_appendices = [] 327 | 328 | # If false, no module index is generated. 329 | # 330 | # texinfo_domain_indices = True 331 | 332 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 333 | # 334 | # texinfo_show_urls = 'footnote' 335 | 336 | # If true, do not generate a @detailmenu in the "Top" node's menu. 337 | # 338 | # texinfo_no_detailmenu = False 339 | 340 | 341 | # -- Options for Epub output ---------------------------------------------- 342 | 343 | # Bibliographic Dublin Core info. 344 | epub_title = project 345 | epub_author = author 346 | epub_publisher = author 347 | epub_copyright = copyright 348 | 349 | # The basename for the epub file. It defaults to the project name. 350 | # epub_basename = project 351 | 352 | # The HTML theme for the epub output. Since the default themes are not 353 | # optimized for small screen space, using the same theme for HTML and epub 354 | # output is usually not wise. This defaults to 'epub', a theme designed to save 355 | # visual space. 356 | # 357 | # epub_theme = 'epub' 358 | 359 | # The language of the text. It defaults to the language option 360 | # or 'en' if the language is not set. 361 | # 362 | # epub_language = '' 363 | 364 | # The scheme of the identifier. Typical schemes are ISBN or URL. 365 | # epub_scheme = '' 366 | 367 | # The unique identifier of the text. This can be a ISBN number 368 | # or the project homepage. 369 | # 370 | # epub_identifier = '' 371 | 372 | # A unique identification for the text. 373 | # 374 | # epub_uid = '' 375 | 376 | # A tuple containing the cover image and cover page html template filenames. 377 | # 378 | # epub_cover = () 379 | 380 | # A sequence of (type, uri, title) tuples for the guide element of content.opf. 381 | # 382 | # epub_guide = () 383 | 384 | # HTML files that should be inserted before the pages created by sphinx. 385 | # The format is a list of tuples containing the path and title. 386 | # 387 | # epub_pre_files = [] 388 | 389 | # HTML files that should be inserted after the pages created by sphinx. 390 | # The format is a list of tuples containing the path and title. 391 | # 392 | # epub_post_files = [] 393 | 394 | # A list of files that should not be packed into the epub file. 395 | epub_exclude_files = ['search.html'] 396 | 397 | # The depth of the table of contents in toc.ncx. 398 | # 399 | # epub_tocdepth = 3 400 | 401 | # Allow duplicate toc entries. 402 | # 403 | # epub_tocdup = True 404 | 405 | # Choose between 'default' and 'includehidden'. 406 | # 407 | # epub_tocscope = 'default' 408 | 409 | # Fix unsupported image types using the Pillow. 410 | # 411 | # epub_fix_images = False 412 | 413 | # Scale large images. 414 | # 415 | # epub_max_image_width = 0 416 | 417 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 418 | # 419 | # epub_show_urls = 'inline' 420 | 421 | # If false, no index is generated. 422 | # 423 | # epub_use_index = True 424 | -------------------------------------------------------------------------------- /docs/source/methods/task.item.rst: -------------------------------------------------------------------------------- 1 | Task item methods 2 | ================= 3 | 4 | Task item methods 5 | 6 | 7 | task.item.getmanifest 8 | --------------------- 9 | Show list of methods. 10 | 11 | 12 | **Parameters:** 13 | 14 | * ```` - 15 | 16 | **Result fields:** 17 | 18 | * ```` - 19 | 20 | **Possible errors:** 21 | 22 | * ```` - 23 | 24 | 25 | **Example:** :: 26 | 27 | 28 | 29 | **Result:** :: 30 | 31 | 32 | task.item.add 33 | ------------- 34 | Create new task. 35 | 36 | **Parameters:** 37 | 38 | * ``TASKDATA`` - task data fields (TITLE, DESCRIPTION, etc.). 39 | 40 | **Result fields:** 41 | 42 | Task id 43 | 44 | **Example:** :: 45 | 46 | bx24.call('task.item.add', { 47 | 'TASKDATA':{ 48 | 'TITLE': 'Test task', 49 | 'DESCRIPTION': 'Task description', 50 | 'RESPONSIBLE_ID': 1 51 | } 52 | }) 53 | 54 | 55 | **Result:** :: 56 | 57 | {u'result': 2104} 58 | 59 | 60 | 61 | 62 | task.item.list 63 | -------------- 64 | Return tasks 65 | 66 | 67 | **Parameters:** 68 | 69 | * ``ORDER`` - Sorting. Fsield is required. The Sort field may have the following values: 70 | * ``TITLE`` - Task name; 71 | * ``DATE_START`` - Start date; 72 | * ``DEADLINE`` - Deadline; 73 | * ``STATUS`` - Status; 74 | * ``PRIORITY`` - Priority; 75 | * ``MARK`` - Rating; 76 | * ``СREATED_BY`` - Creator; 77 | * ``RESPONSIBLE_ID`` - Person responsible; 78 | * ``GROUP_ID`` - Workgroup. 79 | Sort order may have the following values: 80 | * ``asc`` - ascending; 81 | * ``desc`` - descending; 82 | * ``FILTER`` - Filtered field may have the following values: 83 | 84 | * ``ID`` - Task ID; 85 | * ``PARENT_ID`` - Parent task ID; 86 | * ``GROUP_ID`` - Workgroup ID; 87 | * ``CREATED_BY`` - Creator; 88 | * ``STATUS_CHANGED_BY`` - User who modified task status last; 89 | * ``PRIORITY`` - Priority; 90 | * ``FORUM_TOPIC_ID`` - Forum topic ID; 91 | * ``RESPONSIBLE_ID`` - Person responsible; 92 | * ``TITLE`` - Task name (May be searched by [%_] template) ; 93 | * ``TAG`` - Tag; 94 | * ``REAL_STATUS`` - Task status. Constants corresponding to task status: 95 | * ``STATE_NEW`` = 1; 96 | * ``STATE_PENDING`` = 2; 97 | * ``STATE_IN_PROGRESS`` = 3; 98 | * ``STATE_SUPPOSEDLY_COMPLETED`` = 4; 99 | * ``STATE_COMPLETED`` = 5; 100 | * ``STATE_DEFERRED`` = 6; 101 | * ``STATE_DECLINED`` = 7; 102 | * ``STATUS`` - Sorting status. Similar to REAL_STATUS, but has two additional meta status: 103 | * ``-2`` - Overdue task; 104 | * ``-1`` - Newly created task. 105 | * ``MARK`` - Rating; 106 | * ``XML_ID`` - External code; 107 | * ``SITE_ID`` - Website ID; 108 | * ``ADD_IN_REPORT`` - Add task to report (Y|N); 109 | * ``DATE_START`` - Start date; 110 | * ``DEADLINE`` - Deadline; 111 | * ``CREATED_DATE`` - Date created; 112 | * ``CLOSED_DATE`` - Date closed; 113 | * ``CHANGED_DATE`` - Date last modified; 114 | * ``ACCOMPLICE`` - Participant ID; 115 | * ``AUDITOR`` - Observer ID; 116 | * ``DEPENDS_ON`` - Previous task ID; 117 | * ``ONLY_ROOT_TASKS`` - Root tasks only (Y|N); 118 | * ``SUBORDINATE_TASKS`` - Current user's and subordinates' tasks (Y|N); 119 | * ``OVERDUED`` - Were overdue (Y|N); 120 | * ``DEPARTMENT_ID`` - Department ID. 121 | Filter type may be specified before filtered field name: 122 | * ``"!"`` - not equal to 123 | * ``"<"`` - less than 124 | * ``"<="`` - less than or equal to 125 | * ``">"`` - greater than 126 | * ``">="`` - greater than or equal to 127 | "filter value" - single value or dict. 128 | * ``NAV_PARAMS`` - Page-by-page navigation. The following options are available: 129 | * ``nPageSize`` - Number of elements on a page, 130 | * ``iNumPage`` - Page number. 131 | 132 | **Result fields:** 133 | 134 | * ``next`` - Offset for next page 135 | * ``total`` - Total elements by filter 136 | * ``result`` - Tasks list 137 | * ``ACCOMPLICES`` - Contains the user ID's of persons involved in the task (shown in the user interface as participants). 138 | * ``ADD_IN_REPORT`` - A boolean (Y/N) value which, if set to "Y", includes the task in the performance report. 139 | * ``ALLOWED_ACTIONS`` - 140 | * ``ACTION_ACCEPT`` - 141 | * ``ACTION_ADD_FAVORITE`` - 142 | * ``ACTION_APPROVE`` - 143 | * ``ACTION_CHANGE_DEADLINE`` - A boolean (Y/N) value which, if set to "Y", specifies that a responsible person associated with the task is allowed to shift the deadline date. 144 | * ``ACTION_CHANGE_DIRECTOR`` - 145 | * ``ACTION_CHECKLIST_ADD_ITEMS`` - 146 | * ``ACTION_CHECKLIST_REORDER_ITEMS`` - 147 | * ``ACTION_COMPLETE`` - 148 | * ``ACTION_CREATE`` - 149 | * ``ACTION_DECLINE`` - 150 | * ``ACTION_DEFER`` - 151 | * ``ACTION_DELEGATE`` - 152 | * ``ACTION_DELETE_FAVORITE`` - 153 | * ``ACTION_DISAPPROVE`` - 154 | * ``ACTION_EDIT`` - 155 | * ``ACTION_ELAPSED_TIME_ADD`` - 156 | * ``ACTION_PAUSE`` - 157 | * ``ACTION_REMOVE`` - 158 | * ``ACTION_RENEW`` - 159 | * ``ACTION_START`` - 160 | * ``ACTION_START_TIME_TRACKING`` - 161 | * ``ALLOW_CHANGE_DEADLINE`` - 162 | * ``ALLOW_TIME_TRACKING`` - A boolean (Y/N) value which, if set to "Y", specifies that the system keeps tracking of the time spent for the task. 163 | * ``AUDITORS`` - Contains the user ID's of persons who were set to monitor task progress and results (shown in the user interface as observers). 164 | * ``CHANGED_BY`` - The user ID of a person who last updated the task. 165 | * ``CHANGED_DATE`` - Specifies the date the task was last updated. 166 | * ``CLOSED_BY`` - The user ID of a person who completed the task. 167 | * ``CLOSED_DATE`` - Specifies the date the task was completed. 168 | * ``COMMENTS_COUNT`` - Contains the number of forum comments. 169 | * ``CREATED_BY`` - Specifies the user ID of a person who created the task. 170 | * ``CREATED_BY_LAST_NAME`` - The last name of the task creator. 171 | * ``CREATED_BY_NAME`` - Contains the first name of a person who created the task. 172 | * ``CREATED_BY_SECOND_NAME`` - The second name of the task creator. 173 | * ``CREATED_DATE`` - Specifies the date the task was created. 174 | * ``DATE_START`` - Specifies the date the task was started. 175 | * ``DEADLINE`` - Specifies the task deadline date. 176 | * ``DECLINE_REASON`` - A text description of the reason for rejecting the task. 177 | * ``DESCRIPTION`` - Specifies the task description. 178 | * ``DESCRIPTION_IN_BBCODE`` - Specifies the user ID of a person who created the task. 179 | * ``DURATION_FACT`` - Specifies the time required to complete the task, in minutes. 180 | * ``DURATION_PLAN`` - 181 | * ``DURATION_TYPE`` - 182 | * ``END_DATE_PLAN`` - Specifies the date when the task is planned to be finished. 183 | * ``FAVORITE`` - 184 | * ``FORKED_BY_TEMPLATE_ID`` - Contains the ID of a template used to create the task. This field may be empty for tasks created in outdated versions. 185 | * ``FORUM_ID`` - Specifies the ID of the forum containing comments to the task. 186 | * ``FORUM_TOPIC_ID`` - Specifies the ID of the forum topic containing comments to the task. 187 | * ``GROUP_ID`` - Specifies the ID of a workgroup to which this task relates. 188 | * ``GUID`` - A GUID (globally unique identifier) associated with the task. It can be said, with a fair amount of confidence, that this identifier will always remain unique across multiple databases. 189 | * ``ID`` - The current task ID. The identifier is unique across the database. 190 | * ``MARK`` - The rating score given by a task creator. 191 | * ``MATCH_WORK_TIME`` - 192 | * ``MULTITASK`` - 193 | * ``PARENT_ID`` - Specifies the ID of a parent task. 194 | * ``PRIORITY`` - Determines the task priority level. 195 | * ``REAL_STATUS`` - Determines the task's real status set using the ``STATUS`` field. This field is read-only. 196 | * ``RESPONSIBLE_ID`` - The user ID of a person to whom the task is assigned. 197 | * ``RESPONSIBLE_LAST_NAME`` - The last name of the task's responsible person. 198 | * ``RESPONSIBLE_NAME`` - Contains the first name of a person to whom the task is assigned (a responsible person). 199 | * ``RESPONSIBLE_SECOND_NAME`` - The second name of the task's responsible person. 200 | * ``SITE_ID`` - Specifies the ID of the site on which the task was created. 201 | * ``START_DATE_PLAN`` - Specifies the date when the task is scheduled to start. 202 | * ``STATUS`` - Use this field to set the meta status for a task. 203 | * ``STATUS_CHANGED_BY`` - The user ID of a person who changed the task status. 204 | * ``STATUS_CHANGED_DATE`` - Specifies the date the task status was changed. 205 | * ``SUBORDINATE`` - A boolean (Y/N) value which, if set to "Y", specifies that at least one of the task participants is subordinate to a current user. 206 | * ``TASK_CONTROL`` - A boolean (Y/N) value which, if set to "Y", specifies that the task result needs to be approved by a creator. Otherwise, the task will auto close once marked as completed. 207 | * ``TIME_ESTIMATE`` - Specifies a time estimate for the task. 208 | * ``TIME_SPENT_IN_LOGS`` - Specifies the actual time spent for the task, in seconds. 209 | * ``TITLE`` - Specifies the task name. 210 | * ``VIEWED_DATE`` - Contains the date the task was last viewed in the public area by a currently logged in user. 211 | 212 | **Example:** :: 213 | 214 | bx24.call('task.item.list', 215 | {'ORDER': {'GROUP_ID': 'asc'}}, 216 | {'FILTER': {'CREATED_BY': {0: 1}}}, 217 | {'PARAMS': {'NAV_PARAMS': {'nPageSize': 50, 'iNumPage': 2}}} 218 | ) 219 | 220 | 221 | **Result:** :: 222 | 223 | {u'next': 50, 224 | u'result': [{u'ACCOMPLICES': [], 225 | u'ADD_IN_REPORT': u'N', 226 | u'ALLOWED_ACTIONS': {u'ACTION_ACCEPT': False, 227 | u'ACTION_ADD_FAVORITE': True, 228 | u'ACTION_APPROVE': False, 229 | u'ACTION_CHANGE_DEADLINE': True, 230 | u'ACTION_CHANGE_DIRECTOR': True, 231 | u'ACTION_CHECKLIST_ADD_ITEMS': True, 232 | u'ACTION_CHECKLIST_REORDER_ITEMS': True, 233 | u'ACTION_COMPLETE': True, 234 | u'ACTION_CREATE': False, 235 | u'ACTION_DECLINE': False, 236 | u'ACTION_DEFER': True, 237 | u'ACTION_DELEGATE': True, 238 | u'ACTION_DELETE_FAVORITE': False, 239 | u'ACTION_DISAPPROVE': False, 240 | u'ACTION_EDIT': True, 241 | u'ACTION_ELAPSED_TIME_ADD': True, 242 | u'ACTION_PAUSE': False, 243 | u'ACTION_REMOVE': True, 244 | u'ACTION_RENEW': False, 245 | u'ACTION_START': True, 246 | u'ACTION_START_TIME_TRACKING': False}, 247 | u'ALLOW_CHANGE_DEADLINE': u'N', 248 | u'ALLOW_TIME_TRACKING': u'N', 249 | u'AUDITORS': [], 250 | u'CHANGED_BY': u'1', 251 | u'CHANGED_DATE': u'2016-08-21T16:00:44+03:00', 252 | u'CLOSED_BY': None, 253 | u'CLOSED_DATE': u'', 254 | u'COMMENTS_COUNT': u'18', 255 | u'CREATED_BY': u'1', 256 | u'CREATED_BY_LAST_NAME': u'Test user', 257 | u'CREATED_BY_NAME': u'', 258 | u'CREATED_BY_SECOND_NAME': None, 259 | u'CREATED_DATE': u'2016-08-21T15:42:46+03:00', 260 | u'DATE_START': u'', 261 | u'DEADLINE': u'', 262 | u'DECLINE_REASON': None, 263 | u'DESCRIPTION': u'', 264 | u'DESCRIPTION_IN_BBCODE': u'Y', 265 | u'DURATION_FACT': None, 266 | u'DURATION_PLAN': None, 267 | u'DURATION_TYPE': u'days', 268 | u'END_DATE_PLAN': u'', 269 | u'FAVORITE': u'N', 270 | u'FORKED_BY_TEMPLATE_ID': None, 271 | u'FORUM_ID': u'11', 272 | u'FORUM_TOPIC_ID': u'24', 273 | u'GROUP_ID': u'0', 274 | u'GUID': u'{e0216129-7751-47b4-beb2-461ea1e87f99}', 275 | u'ID': u'1684', 276 | u'MARK': None, 277 | u'MATCH_WORK_TIME': u'N', 278 | u'MULTITASK': u'N', 279 | u'PARENT_ID': None, 280 | u'PRIORITY': u'1', 281 | u'REAL_STATUS': u'2', 282 | u'RESPONSIBLE_ID': u'1', 283 | u'RESPONSIBLE_LAST_NAME': u'Test user', 284 | u'RESPONSIBLE_NAME': u'', 285 | u'RESPONSIBLE_SECOND_NAME': None, 286 | u'SITE_ID': u's1', 287 | u'START_DATE_PLAN': u'', 288 | u'STATUS': u'2', 289 | u'STATUS_CHANGED_BY': u'1', 290 | u'STATUS_CHANGED_DATE': u'2016-08-21T15:42:46+03:00', 291 | u'SUBORDINATE': u'N', 292 | u'TASK_CONTROL': u'N', 293 | u'TIME_ESTIMATE': u'0', 294 | u'TIME_SPENT_IN_LOGS': None, 295 | u'TITLE': u'Test task #1', 296 | u'VIEWED_DATE': u'2016-08-21T16:01:07+03:00'}], 297 | ... 298 | u'total': 212} 299 | 300 | 301 | 302 | task.item.getdata 303 | ----------------- 304 | Return task data array. 305 | 306 | 307 | **Parameters:** 308 | 309 | * ```` - 310 | 311 | **Result fields:** 312 | 313 | * ```` - 314 | 315 | **Possible errors:** 316 | 317 | * ```` - 318 | 319 | 320 | **Example:** :: 321 | 322 | 323 | 324 | **Result:** :: 325 | 326 | 327 | 328 | task.item.update 329 | ---------------- 330 | Update task information. 331 | 332 | 333 | **Parameters:** 334 | 335 | * ```` - 336 | 337 | **Result fields:** 338 | 339 | * ```` - 340 | 341 | **Possible errors:** 342 | 343 | * ```` - 344 | 345 | 346 | **Example:** :: 347 | 348 | 349 | 350 | **Result:** :: 351 | 352 | 353 | task.item.delete 354 | ---------------- 355 | Delete task. 356 | task.item.getdescription 357 | ------------------------ 358 | Return task description. 359 | 360 | 361 | **Parameters:** 362 | 363 | * ```` - 364 | 365 | **Result fields:** 366 | 367 | * ```` - 368 | 369 | **Possible errors:** 370 | 371 | * ```` - 372 | 373 | 374 | **Example:** :: 375 | 376 | 377 | 378 | **Result:** :: 379 | 380 | 381 | task.item.getfiles 382 | ------------------ 383 | Return array of links to files attached to the task. 384 | 385 | 386 | **Parameters:** 387 | 388 | * ```` - 389 | 390 | **Result fields:** 391 | 392 | * ```` - 393 | 394 | **Possible errors:** 395 | 396 | * ```` - 397 | 398 | 399 | **Example:** :: 400 | 401 | 402 | 403 | **Result:** :: 404 | 405 | 406 | task.item.getdependson 407 | ---------------------- 408 | Return array of parent task IDs. 409 | 410 | 411 | **Parameters:** 412 | 413 | * ```` - 414 | 415 | **Result fields:** 416 | 417 | * ```` - 418 | 419 | **Possible errors:** 420 | 421 | * ```` - 422 | 423 | 424 | **Example:** :: 425 | 426 | 427 | 428 | **Result:** :: 429 | 430 | 431 | task.item.getallowedactions 432 | --------------------------- 433 | Return array of IDs of allowed task actions. 434 | 435 | 436 | **Parameters:** 437 | 438 | * ```` - 439 | 440 | **Result fields:** 441 | 442 | * ```` - 443 | 444 | **Possible errors:** 445 | 446 | * ```` - 447 | 448 | 449 | **Example:** :: 450 | 451 | 452 | 453 | **Result:** :: 454 | 455 | 456 | task.item.getallowedtaskactionsasstrings 457 | ---------------------------------------- 458 | Return array whose keys are action names and values show whether action is allowed. 459 | 460 | 461 | **Parameters:** 462 | 463 | * ```` - 464 | 465 | **Result fields:** 466 | 467 | * ```` - 468 | 469 | **Possible errors:** 470 | 471 | * ```` - 472 | 473 | 474 | **Example:** :: 475 | 476 | 477 | 478 | **Result:** :: 479 | 480 | 481 | task.item.isactionallowed 482 | ------------------------- 483 | Assert whether action is allowed. 484 | 485 | 486 | **Parameters:** 487 | 488 | * ```` - 489 | 490 | **Result fields:** 491 | 492 | * ```` - 493 | 494 | **Possible errors:** 495 | 496 | * ```` - 497 | 498 | 499 | **Example:** :: 500 | 501 | 502 | 503 | **Result:** :: 504 | 505 | 506 | task.item.delegate 507 | ------------------ 508 | Delegate task to new user. 509 | 510 | 511 | **Parameters:** 512 | 513 | * ```` - 514 | 515 | **Result fields:** 516 | 517 | * ```` - 518 | 519 | **Possible errors:** 520 | 521 | * ```` - 522 | 523 | 524 | **Example:** :: 525 | 526 | 527 | 528 | **Result:** :: 529 | 530 | 531 | task.item.startexecution 532 | ------------------------ 533 | Change task status to "In Progress". 534 | 535 | 536 | **Parameters:** 537 | 538 | * ```` - 539 | 540 | **Result fields:** 541 | 542 | * ```` - 543 | 544 | **Possible errors:** 545 | 546 | * ```` - 547 | 548 | 549 | **Example:** :: 550 | 551 | 552 | 553 | **Result:** :: 554 | 555 | 556 | task.item.defer 557 | --------------- 558 | Change task status to "Deferred". 559 | 560 | 561 | **Parameters:** 562 | 563 | * ```` - 564 | 565 | **Result fields:** 566 | 567 | * ```` - 568 | 569 | **Possible errors:** 570 | 571 | * ```` - 572 | 573 | 574 | **Example:** :: 575 | 576 | 577 | 578 | **Result:** :: 579 | 580 | 581 | task.item.complete 582 | ------------------ 583 | Change task status to "Completed" or "Supposedly completed (requires creator's attention)". 584 | 585 | 586 | **Parameters:** 587 | 588 | * ```` - 589 | 590 | **Result fields:** 591 | 592 | * ```` - 593 | 594 | **Possible errors:** 595 | 596 | * ```` - 597 | 598 | 599 | **Example:** :: 600 | 601 | 602 | 603 | **Result:** :: 604 | 605 | 606 | task.item.renew 607 | --------------- 608 | Change task status to "Pending". 609 | 610 | 611 | **Parameters:** 612 | 613 | * ```` - 614 | 615 | **Result fields:** 616 | 617 | * ```` - 618 | 619 | **Possible errors:** 620 | 621 | * ```` - 622 | 623 | 624 | **Example:** :: 625 | 626 | 627 | 628 | **Result:** :: 629 | 630 | 631 | task.item.approve 632 | ----------------- 633 | Change status of task, waiting for confirmation to "Completed". 634 | 635 | 636 | **Parameters:** 637 | 638 | * ```` - 639 | 640 | **Result fields:** 641 | 642 | * ```` - 643 | 644 | **Possible errors:** 645 | 646 | * ```` - 647 | 648 | 649 | **Example:** :: 650 | 651 | 652 | 653 | **Result:** :: 654 | 655 | 656 | task.item.disapprove 657 | -------------------- 658 | Change status of task, waiting for confirmation to "Pending". 659 | 660 | 661 | 662 | **Parameters:** 663 | 664 | * ```` - 665 | 666 | **Result fields:** 667 | 668 | * ```` - 669 | 670 | **Possible errors:** 671 | 672 | * ```` - 673 | 674 | 675 | **Example:** :: 676 | 677 | 678 | 679 | **Result:** :: 680 | 681 | 682 | 683 | 684 | ---------------- 685 | 686 | 687 | **Parameters:** 688 | 689 | * ```` - 690 | 691 | **Result fields:** 692 | 693 | * ```` - 694 | 695 | **Possible errors:** 696 | 697 | * ```` - 698 | 699 | 700 | **Example:** :: 701 | 702 | 703 | 704 | **Result:** :: 705 | 706 | 707 | 708 | --------------------------------------------------------------------------------