API Docs for: 1.5.0
Show:

ConnectionManager Class

Creates an instance of connection manager object

Constructor

ConnectionManager

(
  • endPointUrl
  • authenticationAgent
  • connectionFactory
  • [siteAccess]
)

Parameters:

  • endPointUrl String

    url to REST root

  • authenticationAgent Object

    Instance of one of the AuthAgents (e.g. SessionAuthAgent, HttpBasicAuthAgent)

  • connectionFactory ConnectionFeatureFactory

    the factory which is choosing compatible connection from connections list

  • [siteAccess] String optional

    SiteAccess to use for requests

Item Index

Methods

notAuthorizedRequest

(
  • [method="GET"]
  • [url="/"]
  • [body=""]
  • [headers]
  • callback
)

Not authorized request function Used mainly for initial requests (e.g. createSession)

Parameters:

  • [method="GET"] String optional

    request method ("POST", "GET" etc)

  • [url="/"] String optional

    requested REST resource

  • [body=""] String optional

    a string which should be passed in request body to the REST service

  • [headers] Object optional

    {object} object literal describing request headers

  • callback Function

    function, which will be executed on request success

request

(
  • [method="GET"]
  • [url="/"]
  • [body=""]
  • [headers]
  • [requestEventHandlers]
  • callback
)

Basic request function

Parameters:

  • [method="GET"] String optional

    request method ("POST", "GET" etc)

  • [url="/"] String optional

    requested REST resource

  • [body=""] String optional

    a string which should be passed in request body to the REST service

  • [headers] Object optional

    {object} object literal describing request headers

  • [requestEventHandlers] Object optional

    a set of callbacks to apply on a specific XHR event like onload, onerror, onprogress, etc.

  • callback Function

    function, which will be executed on request success

Example:

 var connectionManager = jsCAPI.getConnectionManager();

 connectionManager.request(
     'GET',
     '/endpoint',
     '',
     {Accept: 'application/json'},
     {
         upload: {
             onloadstart: someUploadCallback,
             onload: someUploadCallback,
             onloadend: someUploadCallback,
             onprogress: someUploadCallback,
             onabort: someUploadCallback,
             onerror: someUploadCallback,
             ontimeout: someUploadCallback,
         },
         onloadstart: someCallback,
         onload: someCallback,
         onloadend: someCallback,
         onprogress: someCallback,
         onabort: someCallback,
         onerror: someCallback,
         ontimeout: someCallback,
     },
     callback
 );