PHP Quick Start

VisualVault REST API requests using PHP

PHP Folders

Create A Folder

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/';
$endpoint = 'folders';
$request = $baseUrl . $endpoint;
// enter the name and the description of the folder you wish to create
$fields = array(
	'name' => 'testFolder',
	'description' => 'a test folder',
	'allowRevisions' => true
	);
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => array(
		'Authorization: Bearer ' . $AccessToken),
    CURLOPT_POSTFIELDS => http_build_query($fields),
    CURLOPT_URL => $request
    ));
curl_exec($ch);
curl_close($ch);

// RESPONSE
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "POST",
    "href": "https://demo.visualvault.com/api/v1/testjones/default/folders"
  },
  "data": {
    "href": "~/folders/271058a3-9b72-e511-befe-98991b71acc0",
    "dataType": "Folder",
    "id": "271058a3-9b72-e511-befe-98991b71acc0",
    "name": "testFolder",
    "modifyDate": "2015-10-14T10:47:30.06",
    "modifyById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "createDate": "2015-10-14T10:47:30.06",
    "createById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "topLevelFolderId": "10000000-1000-1000-1111-100000000002",
    "folderType": 2,
    "status": 0,
    "folderPath": "/testFolder",
    "parentFolderId": "10000000-1000-1000-1111-100000000002"
  }
}

This endpoint creates folders.

Request a folder by folder path

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/';
$endpoint = 'folders?folderpath=';
// folder path to search for
$folder = 'testFolder';
$request = $baseUrl . $endpoint . $folder;
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_HTTPGET => true,
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer ' . $AccessToken),
    CURLOPT_URL => $request
    ));
curl_exec($ch);
curl_close($ch);

// REQUEST
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "GET",
    "href": "https://demo.visualvault.com/api/v1/testjones/default/folders?folderpath=testFolder"
  },
  "data": {
    "href": "~/folders/271058a3-9b72-e511-befe-98991b71acc0",
    "dataType": "Folder",
    "id": "271058a3-9b72-e511-befe-98991b71acc0",
    "name": "testFolder",
    "modifyDate": "2015-10-14T10:47:30.06",
    "modifyById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "createDate": "2015-10-14T10:47:30.06",
    "createById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "topLevelFolderId": "10000000-1000-1000-1111-100000000002",
    "folderType": 2,
    "status": 0,
    "folderPath": "/testFolder",
    "parentFolderId": "10000000-1000-1000-1111-100000000002"
  }
}
 
    

Searches for a folder by folder path.