Announcements
Methods
- GET/announcements/{id}Receive announcement
- GET/announcementsReceive announcement lists
- POST/announcementsCreate announcement
- POST/announcements/{id}/commentsAdd comment to announcement
GET /announcements/{id}
Receive announcements.
GET https://api.pyrus.com/v4/announcements/11611
Response body
{ "announcement": { "id": 14786, "text": "New announcement", "formatted_text": "New announcement", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false }, "comments": [ { "id": 29662, "text": "Comment", "formatted_text": "Comment", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false } } ] } }
curl
curl -X GET \ 'https://api.pyrus.com/v4/announcements/11611' \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json'
GET /announcements
Receive announcement lists.
GET https://api.pyrus.com/v4/announcements?item_count=100
Response body
{ "announcements": [ { "id": 14786, "text": "Old announcement", "formatted_text": "Old announcement", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false }, "comments": [ { "id": 29662, "text": "Comment", "formatted_text": "Comment", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false } } ] }, { "id": 14787, "text": "New announcement", "formatted_text": "New announcement", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false }, "comments": [ { "id": 29662, "text": "Comment", "formatted_text": "Comment", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false } } ] } ] }
curl
curl -X GET \ 'https://api.pyrus.com/v4/announcements?item_count=100' \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json'
Parameters
item_count | The maximum number of announcement. Default — 100. Possible values — 1-10 000. |
POST /announcements
Create announcements. Returns a created announcement.
POST https://api.pyrus.com/v4/announcements
Request body
{ "text": "New announcement", }
Response body
{ "announcement": { "id": 14786, "text": "New announcement", "formatted_text": "New announcement", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false } } }
curl
curl -X POST \ https://api.pyrus.com/v4/announcement/ \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "text": "New announcement" }'
Parameters
text * | Announcement text. |
attachments | See the attachments values in the create task method or the add comment method. |
*Required field. ** the file’s guid can be used only once (it cannot be sent twice in one request). New attached files are created when you attach more files.
POST /announcements/{id}/comments
Add comment to announcement. Returns the announcement with all comments, including the new one.
POST https://api.pyrus.com/v4/announcements/11613 /comments
Request body
{ "text": "It's done." }
Response body
{ "announcement": { "id": 14786, "text": "New announcement", "formatted_text": "New announcement", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false }, "comments": [ { "id": 29662, "text": "Comment", "formatted_text": "Comment", "create_date": "2022-04-27T10:51:50Z", "author": { "id": 1731, "first_name": "Bob", "last_name": "Smith", "email": "Bob.Smith@gmail.com", "type": "user", "external_id": "", "department_id": 13836, "banned": false } } ] } }
curl
curl -X POST \ https://api.pyrus.com/v4/announcements/11613/comments \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "text": "It's done." }'
Parameters
At least one of the fields below must be populated in the comment. Only the field values you send in your request will be changed in the announcement.
text | Comment text. |
attachments | See the attachments values in the create task method or the add comment method. |