The Laravel API

Introduction

The WebPal-Core extension provides a set of wrapper classes and methods to access the WebPal Server through its API. You can develop applications that:

  • use WebPal Cloud Server for user authentication, leaving the user management to a WebPal admin user
  • use WebPal as the storage backend for documents, versioning, page thumbnailing, and other goodies
  • build custom work flows for document management
  • and others

Example

To interact with WebPal Server in a batch or single-command session, here are some examples of some most often used API calls:

// open a new session to WebPal Cloud Server
$session = new DocumentManagerBatchSession("https://MYSERVER.webpal.net");

// login as a WebPal user
$session->login($user, $password);

// send an arbitrary command to WebPal, here a permissions query
$session->send('permissions', array('path' =><path> ));

// you can also send a request as an XML string
$session->sendXML('<request command="listDirectory" path="1" includeMetaData="yes" />')


// query status of the last command
if ($session->success()) { ... }

// access the server's response as an XML DOMDocument
$dom = $session->getDOM();

// for convenience, the API has functions to iterate the response, here as a list of specific tags
$list = $session->objectlistFromResponse("tagname");

// downloading and saving a document from the WebPal Server
$session->sendDownload('download', [ 'path' =><id> ], $fileName)

 

Class Reference

WebPal

  • WebPal::language()
  • WebPal::webName()
  • WebPal::getWebXML()
  • WebPal::addExtensionScript(string link)
  • WebPal::addExtensionCSS(string link)

AppCompiler

  • AppCompiler::overrideViewDesign(application name, view path, design name)

DMLogin

  • DMLogin::getAPISession()
  • DMLogin::is_logged_in()
  • DMLogin::login(user name, password)
  • DMLogin::logout()
  • DMLogin::sessionMessage()
  • DMLogin::user()
  • DMLogin::user_groups()
  • DMLogin::user_in_group(array groups)

DocumentManagerSession

  • getResultStatus()
  • errorStatus()
  • errorReported()
  • debugInfo()
  • errorMessage($default = '')
  • setSessionID($sessionID)
  • getSessionID()
  • login($userName, $password)
  • logout()
  • createOrUpdateUser(array $args)
  • addOrUpdateSystemShare($user_id, $path,
  • updateUserProfile($id, array $values)
  • userExists(array $args = array())
  • userInfo($login = null, array $args = array())
  • userProfile($id = null, array $args = array())
  • resolvePretty($name)
  • listFromResponse($tagName = 'path')
  • objectlistFromResponse($tagName = 'path')
  • mapFromResponse($tagName = 'value',
  • getPrettyName($path)
  • listRoots()
  • lookup($path, array $args = [])
  • exists($path, $pretty = true, array $args = [])
  • deletePath($path, $pretty = true, $ifExists = false)
  • upload($directory, $fileName, $title, $content,
  • uploadFile($directory, $fileName, $title, $contentFileName,
  • createFolder($directory, $dirName, $pretty = true,
  • rename($path, $name, $pretty = true, $ifExists = false)
  • copy($path, $new_dir, $pretty = true,
  • move($path, $new_dir, $pretty = true,
  • getHeader($name)
  • getHeaders()
  • download($path, $pretty = true)
  • downloadIcon($path, $pretty = true)
  • thumbnail($path, $pretty = true)
  • downloadPDF($path, $pretty = true)
  • search($path, $searchString, $pretty = false, $n = null)
  • getFileInfo($path, $pretty = false, $args = array())
  • listPath($path, $pretty = false, $args = array())
  • listDirectory($path,
  • listDirectoryWithMetaData($path,
  • shareViaEmail($subject,
  • getMetaData($path, $pretty = false, array $parameters = array())
  • updateMetaData($path, $title, $comments = null, $pretty = false)
  • recentlyAdded()
  • hasError()
  • getError()
  • getRequestInfo()
  • send($command, $parameters = array(),
  • toPDF(array $targets,
  • sendXML($xml, $isXML = true)
  • sendDownload($command, $parameters = array(), $fileName)
  • getLastCommand()
  • success()
  • getDOM()
  • getOutput()
  • _readHeader($ch, $header)
  • setVerifyPeer($value)
  • query($xpathQuery, $node = null, $namespaceURI = null)

DocumentBatchManagerSession

  • newQueue()
  • sendQueue()
  • getResultStructure()
  • queueXML(DOMDocument $xml)
  • queueXMLString($xmlString)
  • queue($command,
  • queueLogin($userName, $password)
  • queueCreateFolderIfNotExists($directory, $dirName,
  • queueRenameIfExists($path, $name, $pretty = true)
  • queueMoveIfExists($path, $new_dir, $pretty = true,
  • queueUpload($directory, $fileName, $title, $content,

WPXSL

  • WPXSL::replaceQuotes()
  • WPXSL::getDatasheet()
  • WPXSL::getGlobal()
  • WPXSL::getPath()
  • WPXSL::png_to_jpg()
  • WPXSL::responsive_convert()
  • WPXSL::theWeb()
  • WPXSL::matchLang()
  • WPXSL::solrSearch()
  • WPXSL::webname()
  • WPXSL::webpreview()
  • WPXSL::request_param()
  • WPXSL::findNode()
  • WPXSL::nodePath()

Other

  • SolrIndex
  • rawQuery()