PHP Quick Start

VisualVault REST API requests using PHP

PHP Persisted Data

Create An Instance of Persited Data

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}';
$endpoint = '/persistedData';
// mandatory fields for persisted data
$fields = [
	'name' => 'pData Sample2',
	'scope' => 1,
	'persistedData' => "{\"invoice no\":\"272255\",\"formname\":\"orderform\",\"Address\":\"ds\"}",
	'dataMimeType' => 'text/JSON',
	'linkedObjectId' => '',
	'linkedObjectType' => 0,
	'expirationDateUtc' => null
	];
$request = $baseUrl . $endpoint;
$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": "http://dev68/visualvault4_1_12/api/v1/{customerAlias}/{databaseAlias}/persistedData"
  },
  "data": {
    "href": "~/persistedData/17bd31bb-6cd6-43b0-be65-55e2002d91a6",
    "dataType": "PersistedData",
    "id": "17bd31bb-6cd6-43b0-be65-55e2002d91a6",
    "createByUsId": "5eefec33-ca71-e511-befe-98991b71acc0",
    "createDateUtc": "2015-11-02T16:38:13.487",
    "persistedData": "{\\'invoice no\\':\\'273255\\',\\'formname\\':\\'orderform\\',\\'Address\\':\\'ds\\'}",
    "dataLength": 73,
    "dataMimeType": "text/JSON",
    "expirationDateUtc": null,
    "linkedObjectId": "",
    "linkedObjectType": 0,
    "modifiedByUsId": "5eefec33-ca71-e511-befe-98991b71acc0",
    "modifiedDateUtc": "2015-11-02T16:38:13.487",
    "name": "pData Sample 2",
    "scope": 1
  }
}

creates an instance of persisted data. the fields in the fields array are mandatory fields

Request Instances of Persisted Data

// REQUEST
$AccessToken = '{AccessToken}';
$baseUrl = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}';
$endpoint = '/persistedData';
$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}/persistedData"
  },
  "data": [
    {
      "href": "~/persistedData/17bd31bb-6cd6-43b0-be65-55e2002d91a6",
      "dataType": "PersistedData",
      "id": "17bd31bb-6cd6-43b0-be65-55e2002d91a6",
      "name": "pData Sample 2"
    },
    {
      "href": "~/persistedData/eb5692b1-51ce-4afb-b8b2-ac613959ec5c",
      "dataType": "PersistedData",
      "id": "eb5692b1-51ce-4afb-b8b2-ac613959ec5c",
      "name": "pData Sample"
    },
    {
      "href": "~/persistedData/9be5e5bc-1628-44ed-bb12-8aa5d7784705",
      "dataType": "PersistedData",
      "id": "9be5e5bc-1628-44ed-bb12-8aa5d7784705",
      "name": "ta7stPJQnk6I7lgJdu0oMg"
    }
  ],
  "pagination": {
    "dataType": "PagedData",
    "href": "",
    "first": "",
    "last": "",
    "limit": 200,
    "next": "",
    "previous": "",
    "totalRecords": 3
  }
}

returns all instances of persisted data