LMS Collaborator knowledge base

Home/Technical requirements/API/API - News

API – News

API - News list #

See API-Authorization

Request example:
curl 'http://localhost:8080/api/rest.php/news?page=1&count=10&action=get-all-public-news' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8'


Answer

  • In case of successful request (HTTP response code - 200), the following result will be returned:
    data - news array
    pager - pagination object (information about the number of pages, the current page, the number of tasks)
    counts - counter object (information about the number of tasks grouped by statuses)
  • In case of error (HTTP response code - 400) it returns JSON object with error information

API - Adding news #

  • To create news you need to send POST request to URI /api/rest.php/news
  • The request body must contain a JSON object with information about the news.
  • The request must contain the following headings Content-Type: application/json;charset=UTF-8 и Authorization: Bearer xxxxxx.

Request example:
curl 'http://localhost:8080/api/rest.php/news' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"title":"1", "body_text":"body"}'


Format of the object with information about the user

* Required fields are marked with an asterisk

Field Type Description
title* Line News title
_bodytext* Line Text
is_published Number Flag, 1 - news published, 0 - the news is NOT published
publicat* Line Publication date

Answer

  • In case of successful request (HTTP response code - 200), there will be reply in JSON format with information about created news:
    {"data":{"id":105,"title":"title","body_text":"body","is_published":true...}
    -In case of error (HTTP response code - 400) it returns JSON object with error information:
    {"title":{"required":"Field cannot be empty"}}
Still have questions?
Our technical support team is always happy to help!
Write to us at technical support [email protected]. If you are registered on our Helpdesk - send request button below.
Send request