Website API

Sitograph API

Each module can implement an extension for API calls.

API output is encoded with JSON.

Example output:

{
  "ok": true,
  "data": {
    "2": {
      "id": "2",
      "published": "1",
      "deleted": "0",
      "author": "api",
      "updated": "10.07.2017 11:53:30",
      "lang": "en",
      "sticked": "0",
      "url": "the-beautiful-photo-gallery-is-attached-to-this-post",
      "date": "07.07.2017 22:41:28",
      "email": "cyhiso",
      "title": "The Beautiful photo gallery is attached to this post",
      "description": "",
      "text": "....",
      "pic": "/content/articles/2017/07/59634e99ef619-pic.jpg",
      "pic_preview": "/content/articles/2017/07/59634e9a1b4c2-pic_preview.jpg",
      "album_id": "1",
      "views": "0",
      "shares": "0",
      "comments": "0"
    },
    "3": { .. },
	"4": { .. },
	..
  },
  "msg": ""
}

Example of empty output:

{
	"ok":true,
	"data":[],
	"msg":"Empty result"
}

Example of error output:

{
	"ok":false,
	"data":[],
	"msg":"Wrong API call"
}

API functions installed by default

Module Blog

URLAccessPHP FunctionDescription
/api/blog/list/ everyone api_request_blog() List of published articles
/api/blog/category/ everyone api_request_blog() List of categories for articles
/api/blog/details/12345/ everyone api_request_blog() Details about article ID 12345
/api/blog/add/ user api_request_blog() Publish new article
/api/blog/edit/ admin api_request_blog() Edit article field

Module Gallery

URLAccessPHP FunctionDescription
/api/gallery/list/ everyone api_request_gallery() List of published albums
/api/gallery/album/12345/ everyone api_request_gallery() List of photos for an album ID 12345
/api/gallery/add/ user api_request_gallery() Publish new album
/api/gallery/edit-album/ admin api_request_gallery() Edit album field
/api/gallery/edit-photo/ admin api_request_gallery() Edit photo field

Module Feedback

URLAccessPHP FunctionDescription
/api/feedback/list/ everyone api_request_feedback() List of published feedback items
/api/feedback/add/ everyone api_request_feedback() Publish new feedback
/api/feedback/edit/ admin api_request_feedback() Edit feedback field

Module Search

URLAccessPHP FunctionDescription
/api/more_search/ everyone ajax_More_Search() Get website text search results

Module Core

URLAccessPHP FunctionDescription
/api/structure/list/ admin api_request_structure() List data in structure table
/api/structure/edit/ admin api_request_structure() Change field value in structure table
/api/structure/add/ admin api_request_structure() Add row to structure table
/api/document/list/ admin api_request_document() List data in documents table
/api/document/edit/ admin api_request_document() Change field value in documents table
/api/document/add/ admin api_request_document() Add row to documents table
/api/settings/list/ admin api_request_settings() List website settings
/api/settings/add/ admin api_request_settings() Add row to website settings
/api/settings/edit/ admin api_request_settings() Change field value in website settings
/api/uploadpic/ admin ajaxUploadPicture() Upload file to file storage
/api/cron/hourly/ dev api_request_cron() URL to run Cron jobs, runs hourly
/api/cron/daily/ dev api_request_cron() URL to run Cron jobs, runs daily
/api/cron/weekly/ dev api_request_cron() URL to run Cron jobs, runs weekly

URL and access level can be configured in module XML