PHP Quick Start

VisualVault REST API requests using PHP

PHP Sites

Create A Site

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}';
$endpoint = '/sites';
$request = $baseUrl . $endpoint;
// mandatory fields for site creation
$fields = [
	'name' => 'pracSite',
	'description' => 'a practice site'
	];
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => array(
		'Authorization: Bearer ' . $AccessToken),
    CURLOPT_URL => $request,
    CURLOPT_POSTFIELDS => http_build_query($fields)
	));
curl_exec($ch);
curl_close($ch);

// RESPONSE        
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "POST",
    "href": "https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/sites"
  },
  "data": {
    "href": "~/sites/731b6a65-9281-e511-bf03-008cfa482110",
    "dataType": "Site",
    "id": "731b6a65-9281-e511-bf03-008cfa482110",
    "name": "pracSite",
    "description": "a practice site",
    "siteType": "Location",
    "status": "Open"
  }
}


creates a site

Requests Sites

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}';
$endpoint = '/sites';
$request = $baseUrl . $endpoint;
$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);

// RESPONSE            
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "GET",
    "href": "https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/sites"
  },
  "data": [
    {
      "href": "~/sites/10000000-1000-3000-1111-100000000020",
      "dataType": "Site",
      "id": "10000000-1000-3000-1111-100000000020",
      "name": "Home",
      "description": "Home Site",
      "siteType": "Location",
      "status": "Open"
    },
    {
      "href": "~/sites/b1e499af-9272-e511-befe-98991b71acc0",
      "dataType": "Site",
      "id": "b1e499af-9272-e511-befe-98991b71acc0",
      "name": "test",
      "description": "this is a test site",
      "siteType": "Location",
      "status": "Open"
    }
  ]
}

requests sites