PHP Quick Start

VisualVault REST API requests using PHP

PHP Index Fields

request index field definitions

// REQUEST
$AccessToken = '{AccessToken}';
$url = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/';
$endpoint = 'indexfields';
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_HTTPGET => true,
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
	'Authorization: Bearer ' . $AccessToken),
    CURLOPT_URL => $url . $endpoint
	));
curl_exec($ch);
curl_close($ch);
// RESPONSE
{
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "GET",
    "href": "https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/indexfields"
  },
  "data": [
    {
      "href": "~/indexfields/eebd4696-5b7e-e511-bf02-008cfa482110",
      "dataType": "IndexFieldDefinition",
      "pkey": 3,
      "id": "eebd4696-5b7e-e511-bf02-008cfa482110",
      "fieldType": 2,
      "label": "dogs",
      "description": "a list of dogs",
      "required": false,
      "connectionId": "00000000-0000-0000-0000-000000000000",
      "queryId": "00000000-0000-0000-0000-000000000000",
      "queryDisplayField": "",
      "queryValueField": "",
      "dropDownListId": "e4c5e1a5-587e-e511-bf02-008cfa482110",
      "defaultValue": "rotty",
      "createDate": "2015-10-29T16:39:14.3",
      "createById": "5eefec33-ca71-e511-befe-98991b71acc0",
      "createBy": "vault.config",
      "modifyDate": "2015-10-29T16:39:14.3",
      "modifyById": "5eefec33-ca71-e511-befe-98991b71acc0",
      "modifyBy": "vault.config"
    }
  ],
  "pagination": {
    "dataType": "PagedData",
    "href": "",
    "first": "",
    "last": "",
    "limit": 200,
    "next": "",
    "previous": "",
    "totalRecords": 1
  }
}

Requests a list of index field definitions

create an index field definition

// REQUEST
$AccessToken = '{AccessToken}';
$url = 'https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/';
$endpoint = 'indexfields';
$fields = [
    'label' => 'pokerHands',
    'description' => 'a list of poker hands',
    'fieldType' => 2,
    'queryId' => '00000000-0000-0000-0000-000000000000',
    'dropDownListId' => '75646376-697E-E511-BF02-008CFA482110',
    'queryValueField' => '',
    'queryDisplayField' => '',
    'required' => true,
    'defaultValue' => 'rotty'
    	];
$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 => $url . $endpoint
	));
curl_exec($ch);
curl_close($ch);

// RESPONSE
            {
  "meta": {
    "status": 200,
    "statusMsg": "OK",
    "method": "POST",
    "href": "https://demo.visualvault.com/api/v1/{customerAlias}/{databaseAlias}/indexfields"
  },
  "data": {
    "href": "~/indexfields/78c111ba-697e-e511-bf02-008cfa482110",
    "dataType": "IndexFieldDefinition",
    "pkey": 4,
    "id": "78c111ba-697e-e511-bf02-008cfa482110",
    "fieldType": 2,
    "label": "pokerHands",
    "description": "a list of poker hands",
    "required": false,
    "connectionId": "00000000-0000-0000-0000-000000000000",
    "queryId": "00000000-0000-0000-0000-000000000000",
    "queryDisplayField": "",
    "queryValueField": "",
    "dropDownListId": "75646376-697e-e511-bf02-008cfa482110",
    "defaultValue": "rotty",
    "createDate": "2015-10-29T11:20:27.307",
    "createById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "createBy": "vault.config",
    "modifyDate": "2015-10-29T11:20:27.307",
    "modifyById": "5eefec33-ca71-e511-befe-98991b71acc0",
    "modifyBy": "vault.config"
  }
}

Creates an Index Field Definition. All fields above are required for a successfull request.