Overview

These API calls are related to basic object management. The calls are working only under administration environment. Executing any of these API calls requires an extra parameter(s) for authentication. It could be either of:

  • "auth_token", typically obtained via SK.Singletons.env.get( "session_id" )
  • "api_key" and "login"


ObjectIDs

Each object has an "obj_id" which determines the type of the object. List of object IDs is provided below.

  • Page — 1
  • Text and Image — 11
  • Form —69
  • Gallery — 70
  • Gallery Image — 71
  • Section Group — 93
  • Section —  42
  • HTML Snippet — 25
  • Container - 94


Operations

object.get

  • node_id - the node ID of the object to get information about
  • properties - JSON-encoded array of property names to fetch (optional)
Returns meta information and properties of an object in the following format:
{
    "meta": {
        "published": "0 or 1",
        "obj_order": "0..n",
        "node_id": "",
        "obj_inst": "",
        "obj_id": "",
        "parent_id": ""
    },
    "properties": {
        "": "",
        ...
    }
}

object.set

  • node_id
  • properties — JSON encoded hash with key-value pairs
  • properties_type - “editable” or “rendered” (default “editable”) — if set to “rendered”, after the properties are updated, they will be returned as they would be rendered on the page
  • return_properties - 0 or 1 (default 1) — if set to 0, the properties will be set but will not be returned. This is useful to avoid unnecessary network traffic

Set properties of an object and return the updated properties.

object.get_rendered_template

  • node_id
  • path (optional) — path to the template which should be rendered. If not specified, the default template for the given node_id will be used
  • serialize - 0 or 1 (default 1) — if set to 1, the rendered template will be returned serialized in JSON, otherwise the template will be returned as-is

Render html template, using the properties of the input node id.

object.add

  • parent_id — node_id of the area where the new object should be placed
  • obj_id — refer to the top of the page
  • obj_inst
  • obj_order — either an integer specifying the order of the object, or string "top"/"bottom"
  • properties — key-value pairs

Adds an object and returns an information structure like object.get.

object.add_multiple

  • objects - array of objects as given in object.add, recommended to be listed in the order expected to be added despite obj_order property, per object it should contain
        ◦ parent_id — node_id of the area where the new object should be placed
        ◦ obj_id — refer to the top of the page
        ◦ obj_inst
        ◦ obj_order — either an integer specifying the order of the object, or string "top"/"bottom"
        ◦ properties — stringified key-value pairs object

object.remove

    • node_id

Removes an object by its NodeID. The object must not be referenced by other objects or an error is returned. 

  • node_id — node_id of the object which should be moved
  • parent_id — node_id of the area where the object should be moved to
  • obj_order — either an integer specifying the order of the object, or string "top"/"bottom"
Moves an object and returns the node_id of the moved object. Note: when moved, the object will have a new object id.

object.page.get

This call may be executed in 2 ways - using a session ID for authentication or using an API authentication token. The first way works only in admin view. The second one works in both views. Here's the first way of executing the API call:
auth_token - equals the current session ID. If the SK.API JavaScript library is used, it's initialized with "new SK.API( )" which automatically uses the current session.

  • node_id - the ID of the page
  • properties - an array of properties names which one wants to retrieve. If this parameter does not exist, all available properties will be returned
  • anchors - 0 or 1 (default 0) - whether to return the list of anchors on the page or not.
  • areas - 0 or 1 (default 0) - whether to return node IDs of areas where objects can be added (with object.add)
  • shared_areas - 0 or 1 (default 0) - return node IDs of shared areas where objects can be added
  • references - 0 or 1 (default 0) - return references to this page
  • layouts - 0 or 1 (default 0) - return available page layouts, including optional containers in each layout
  • schemes - 0 or 1 (default 0) - return available page color schemes
You will receive the following response:
{
   "is_published": 1,
   "is_home_page": 0,
   "is_404_page": 0,
   "properties": {
      "...property name1...": "...property value1...",
      "...property name2...": "...property value1...",
      ...
   },
   "anchors": [   // Exists only if "anchors=1"
      {
         "link": "...",  
         "name": "..."
      },
      {
         "link": "...",  
         "name": "..."
      },
             ...
   ],
     "shared_areas": [
          {
            "node_id": "253082",
            "obj_inst": "SHARED_PANEL_ELEMENT"
          },
          {
            "node_id": "253099",
            "obj_inst": "SHARED_ELEMENT4"
          },
          {
            "node_id": "253107",
            "obj_inst": "FOOTER_SHARED_ICONS"
         }
          ...
   ]
}

In admin view you will receive all available properties for the page element.
The other way of execution is

  • auth_token - the same API key you use for the DB API
  • node_id - the ID of the page

The result will be in the same format as above, but in normal view the number of properties would be quite limited, but will include the "URL" property and the page "Title". The URL property will contain an absolute URL using the first custom domain (if there's any). Otherwise you will have http:////.

object.page.get_multiple

  • node_ids - JSON array holding the Page NodeIDs
  • properties (optional)
  • anchors (optional)
  • areas (optional)
  • shared_areas (optional)
  • references (optional)
  • layouts (optional)
  • schemes (optional)

This API returns details for multiple pages. Refer to object.page.get for details about the input parameters.

object.page.get_tree

  • node_id - the ID of the page

Returns a tree structure representing all the page's areas and the elements in the areas.

object.page.get_size

  • node_id - the ID of the page

The API returns the storage usage of the page.

object.page.add

Add a new page to the site. Input parameters:

  • properties - JSON encoded hash of key-value pairs. If no "properties" are specified, the page will not be added to any navigation menu and it's name will be given by the system. If property "AddToNavMenu" is set to 1, the page will be added to the main navigation menu. Property "Title" may be used to set the page's title.If property “AddAreas” (default 0) is set to 1, all areas will be created on the page, which will allow adding objects to those areas via the API. If “AddAreas” is 0, the areas will not be created until the page is displayed in a browser.​

object.page.publish

  • node_id - the ID of the page

Publish the page referred by this "node_id".

object.page.move_to_folder

  • node_id - the ID of the page
  • folder_id (optional) - the ID of the folder

Move the page to the specified folder. If "folder_id" is not specified or empty, the page is moved to the root.

object.page.get_default_contents

Get the default contents which can be used to create pages with pre-defined content.

object.page.duplicate

  • node_id - the ID of the page which should be duplicated
  • replacements (optional) - JSON key-value object. The specified keys will be replaced with the corresponding values on the newly created page.
  • add_to_main (optional) - 0 or 1 (default 0). If 1, the newly created page will be added to the main navigation.

Duplicate the page and optionally apply replacements on the new page. The "node_id" must be a NodeID of a page owned by the current user, or a NodeID returned by object.page.get_default_contents

object.site.get

Returns the properties of the site object.

object.site.set

  • properties — JSON encoded hash with key-value pairs
  • publish — 0 or 1 (default 0). If publish is 0 the user will be placed in Preview Mode, otherwise changes will take effect immediately, affecting both the Admin and End-user site. Note this will publish only the site object, without publishing other objects (pages etc.).
  • switch_design - 0 or 1 (default 0). If set to 1, any design properties whose value is an URL, will be requested via HTTP and the HTTP response will be used for the property value. For example, if a design property is set to "http://designs.nccdn.net/Merak/layout.json", the property will be set to whatever the response of the HTTP request is.
  • variables (optional) - a hash. It is used with "content" when there are variables like $VariableName$ in the base site content it is replaced with the value in the hash which has key "VariableName"
Sets properties of the site object. Possible properties are:
  •  SiteTitle — change site title
  •  LogoSrc — URL to an image
  •  LogoImageHeight — number (it will be set in px)
  •  LogoImageWidth — number (it will be set in px)
  •  LogoType — "__None__" to use the site title or  "__Custom__" to use the custom image in LogoSrc​
  •  ActiveDomain — 0 or 1. Disable/enable the custom domain for this site
Possible design properties are:
  • DesignID
  • CollectionDesignID
  • SchemeKey
  • CustomCSS
  • LogoSize
  • DefaultPageLayout
  • DefaultCustomSchemeKey
  • DefaultMenuItemColor
  • DefaultMenuAlignment
  • DefaultMenuStyle
  • DefaultSubmenuAnimation
  • DefaultSubmenuLayout
  • DefaultPageImage
  • CustomImagesJSON
  • CustomStylesJSON
  • CustomLayoutJSON
  • CustomMediaSelectorsJSON


Possible 'variables' are:

  • about
  • address
  • cat_name
  • category
  • category_id
  • city
  • collection_design_id
  • contactinfo
  • country
  • domain
  • email
  • full_name
  • information
  • lang
  • lat
  • lng
  • login
  • name
  • phone
  • postalcode
  • province
  • site_title
  • slogan

object.site.set_preview_mode

  • preview_mode - 0 or 1

Sets the site in preview mode. The preview mode flag will be printed on the page. To retrieve the current value of "preview_mode", this can be used SK.Singletons.env.get("preview_mode").

object.site.set_header_snippet

  • app_id - application ID
  • mode - AdminOnly or Both - when AdminOnly or not specified, the snippet will be updated only in admin view and the site will become in "Preview mode". If "Both" is used the changes will be replicated in normal view
  • snippet - the HTML snippet code

This call adds a snippet related to a certain application and this snippet is put in the section of every page.

object.site.remove_header_snippet

  • app_id

Removes the HTML snippet from the section that's related to the given application ID.

object.site.get_pages

  • list_removed (optional) - provides a list of all removed pages that are still available on published site
  • properties (optional) - JSON encoded array of link properties which one wants to retrieve. If this parameter does not exist, all available properties will be returned. The currently available properties are:

- anchors_num - number of anchors on the page
- node_id - the page node ID
- name - the page name 
- full_url - <folder>/<page URL>
- folder_name - the name of the folder the page stays in
- link - the link to the page used within the system
- url - the <page URL> 
- published_url - the published version of <page URL>
- published - whether the page is published or not - 1 or 0
- anchors - an array of anchors on the page which is an array of hash elements with structure { "link": "...", "name": "..." }

Returns a list of all pages for a given account. The user_id must be the same user_id as the ID of the owner of the session ID/auth_token. The following structure is in the result:


{
   "pages": {
      "links": [
         {
            "name": "",
            "link": "" (usually the node ID of the page)
         },
         ...
      ],
      "link_types": {
         "": "",
         ...
      }
   }
}

The "link_types" represents system IDs of link types that are used throughout the product.

object.site.publish_all_pages

Publish all pages of the site.

object.site.publish

Publishes the Admin changes of the site object to the End-user mode.

object.site.revert

Reverts the Admin changes of the site object, applying the End-user mode property values to Admin mode.

object.site.duplicate

  • new_login

Creates a copy of the account with the specified login.

object.remove_multiple

  • node_ids - JSON array holding the object NodeIDs

Removes multiple objects by their NodeID. Objects must not be referenced by other objects.

object.main_navigation.get

Returns the main navigation object. Accepts no additional input parameters. Sample output:

{
    "meta": {
        "node_id": "253153",
        "obj_id": "60",
        "obj_inst": "",
        "obj_order": "0",
        "parent_id": "0",
        "published": "0"
    },
    "properties": {}

object.hide_multiple

  • node_ids - JSON encoded array holding the object NodeIDs

Hides multiple objects by their NodeID.

object.show_multiple

  • node_ids - JSON encoded array holding the object NodeIDs

Shows multiple objects by their NodeID.