Announcement

Announcement List

GET ‎https://<domain>/<api prefix>/<version>/announcements/get/list/

This API endpoint will return a list of announcements.

Query Parameters

NameTypeDescription

offset

string

limit

string

read_status

string

0(unread) or 1(readed),default value is 1

subject

string

subject text

start_date

string

formate: mm/dd/yyyy

end_date

string

formate: mm/dd/yyyy

created

string

formate: mm/dd/yyyy

Headers

NameTypeDescription

apikey*

string

apikey

Authorization*

string

Bearer access token

​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.

Headers

NameTypeDescription

apikey*

string

Apikey

Authorization*

string

Bearer access token

Request Body

NameTypeDescription

slug*

string

Announcement slug

​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.

Last updated