Announcement

Announcement List

get
​

β€Žhttps://<domain>/<api prefix>/<version>/announcements/get/list/
This API endpoint will return a list of announcements.
Request
Response
Request
Headers
apikey
required
string
apikey
Authorization
required
string
Bearer access token
Query Parameters
offset
optional
string
​
limit
optional
string
​
read_status
optional
string
0(unread) or 1(readed),default value is 1
subject
optional
string
subject text
start_date
optional
string
formate: mm/dd/yyyy
end_date
optional
string
formate: mm/dd/yyyy
created
optional
string
formate: mm/dd/yyyy
Response
200: OK
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {
"results": [
{
"id": <announcement_id>,
"subject": "<announcement_subject>",
"message": "<announcement_meessage>",
"types": "<announcement_types>",
"image": "<image>",
"slug": "<announcement_slug>",
"start_date": "<start_date>",
"end_date": <end_date>,
"created": "<created_date>"
},
...
],
"count": <list_count>,
"previous": <previous_page_url>,
"next": <next_page_url>
}
}

Sample Code

Node

var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/get/announcements-list/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
​

PHP

<?php
​
$curl = curl_init();
​
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/get/announcements-list/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array(),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
​
$response = curl_exec($curl);
​
curl_close($curl);
echo $response;

Error Responses

Status Code

Error Type

FIeld

Description

400

Validation Error

start_date,

end_date,

created

Invalid date format.

Close Announcement

post
​

β€Žhttps://<domain>/<api prefix>/<version>/announcements/close/
This API endpoint will close an announcement.
Request
Response
Request
Headers
apikey
required
string
Apikey
Authorization
required
string
Bearer access token
Body Parameters
slug
required
string
Announcement slug
Response
200: OK
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}

Sample Code

Node

var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/close/announcement/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'slug': '<announcement_slug>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

PHP

<?php
​
$curl = curl_init();
​
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/close/announcement/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('slug' => '<announcement_slug>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
​
$response = curl_exec($curl);
​
curl_close($curl);
echo $response;
​

Error Responses

Status Code

Error Type

FIeld

Description

400

Validation Error

slug

This field is required.

This field may not be blank.

Requested announcement not found.

You can't close the requested announcement.

​

​