Sirportly

Toggle Menu

Find a page

This method will return details about a given page within a known knowledge base.

URL

/api/v2/knowledge/page

Access

Only account tokens are permitted to access this method

Parameters Supported

  • kb - the ID of the knowledge base (requried)
  • path - the path to the page you wish to find (optional, will return the homepage if no path)

Returned Data

The server will return full information about the requested page in a variable named page as well as the full path which defines where this page sits within your hierarchal tree. This path array can be used to generate breadcrumbs and determine the page's ancestors. The closest ancestor will be the first item in the array. The children array will contain all the child pages which exist within this page - this can be used to generate any {{nav}} lists if entered into the page.

The page content variable contains the raw page content. If you are rendering this information to users, you may need to run additional processing to turn this into HTML.

Example JSON

{
  "page": {
    "id": 42,
    "title": "API Documentation",
    "permalink": "api-specification",
    "full_permalink": "api-specification",
    "position": 1,
    "content": "Sirportly provides an API providing access to all the data stored within your account. Primarily, this API is used for managing ticket data however you can also retrieve lists of other meta objects (such as statuses, priorities etc...). This document outlines all the methods which are available with example output as well as which parameters can be passed to them.\r\n\r\n### API Endpoint\r\n\r\nIf you are using the hosted/cloud version of Sirportly, you should send all your API requests to `api.sirportly.com`. This request can be made using HTTP or HTTPS the choice is yours but we strongly recommend that you use HTTPS.\r\n\r\nIf you have the downloaded version, you should just send requests to the domain where you have installed Sirportly. The choice of HTTP/HTTPS depends on the configuration of your local web server.\r\n\r\n### Authentication\r\n\r\nIn order to authenticate to the API you will need to create an API Token from within the admin interface of your Sirportly account. Once the API token has been created, you will be provided with a token and a secret which you will use to authenticate any requests you wish to make to the API.\r\n\r\nAPI tokens can be restricted to certain IP addresses and/or certain API methods. These can be selected through the admin interface.\r\n\r\nWhen making the request you should set HTTP headers for `X-Auth-Token` and `X-Auth-Secret` using the data provided from the API token.\r\n\r\n###Passing & Receiving Data\r\n\r\n* All data is returned from the API in JSON format.\r\n* You may use any HTTP method when communicating with the API. We recommend using POST.\r\n* All parameters must be sent as standard HTTP params using the name outlined in the documentation.\r\n* The status of the request can be determined from the HTTP status code.\r\n  * `200 OK` - your request was successful and the appropriate data has been returned as JSON.\r\n  * `201 Created` - the object you were trying to create has been created successfully. The JSON representation of your new object will be returned as JSON.\r\n  * `404 Not Found` - the object you were requesting or an object you have tried to assign does not exist within your account. Further details are provided as JSON.\r\n  * `403 Forbidden` - the request could not be authenticated - your token/secret is invalid, the IP you are requesting from does not have access or you do not have access to the method. Further details are provided in the JSON.\r\n  * `409 Conflict` - you are not permitted to remove the requested object.",
    "user": {
      "id": 6,
      "username": "adam",
      "first_name": "Adam",
      "last_name": "Cooke",
      "email_address": "adam@atechmedia.com",
      "time_zone": "London",
      "created_at": "2012-01-12T22:09:01Z"
    },
    "created_at": "2012-01-26T11:02:45Z",
    "updated_at": "2012-01-27T18:21:26Z"
  },
  "path": [

  ],
  "children": [
    {
      "id": 43,
      "title": "Tickets",
      "permalink": "tickets",
      "full_permalink": "tickets",
      "position": 1
    },
    {
      "id": 44,
      "title": "Knowledge Base",
      "permalink": "knowledge-base",
      "full_permalink": "knowledge-base",
      "position": 2
    },
    {
      "id": 45,
      "title": "Meta Objects",
      "permalink": "meta-objects",
      "full_permalink": "meta-objects",
      "position": 3
    }
  ]
}