PHP Quick Start

VisualVault REST API requests using PHP

Embed a VisualVault Form into your application using the PHP REST Client Library

Important! The following definitions are important to understand

Form Template: Designed in the VisualVault Form Design tool and used when creating Form Data Instances. Think of a Form Template as a master Form which is copied to a new record each time a user submits a new Form.

Form Instance: Form Instances are the forms submitted using a Form Template.

Form Instance Revisions: Each Form Instance may have multiple 'Instance Revisions'. When a user submits a new Form they are creating Intance revision 1. Each instance revision has its own resource Id (GUID). When you modify a Form Instance Revision, the VisualVault server creates a new revision and returns the new revision's resource Id.

For additional information on VisualVault Forms please review the online help guide located at http://help.visualvault.com

    
    // import the .php files from the library.
    require_once 'endpoints/formTemplates.php';
    require_once 'endpoints/pData.php';
    require_once 'endpoints/users.php';
    // create an object.
    $u = new Users();
    $f = new FormTemplates();
    $p = new PersistedData();
    // first method call requests and stores the users WebToken (userId is passed in here).
    $userToken = $u->getUsersToken('5eefec33-ca71-e511-befe-98991b71acc0');
    // Now pass in a formTemplate revision id of the form you want returned, and the userToken 
    // passed in from the previous method call.
    $f->embedForm('9d4d2408-1183-e511-bf05-9c4e36b08790',$userToken);
    
    // RESPONSE
    https://demo.visualvault.com/VVlogin?token=e5dd1420-0d8e-e511-bf05-9c4e36b08790&returnUrl=~%2fFormDetails%3fformid%3d9d4d2408-1183-
    e511-bf05-9c4e36b08790
        

An encoded URL is returned that you may use in your application as an anchor tag target, i-frame source, etc. This URL will render a Form Data 'Instance' using the Form Template

Embed a VisualVault Form into your application and Populate the Form using Persisted Data (uses the PHP REST Client Library)

Important! Persisted Data is an API which allows you to send a dictionary of key & value pairs to the VisualVault Server. Persisted data dictionaries are stored in the VV Server database and may be used to populate Forms.

See the Persisted Data PHP Code Example

    // import the .php files from the library.
    require_once 'endpoints/formTemplates.php';
    require_once 'endpoints/pData.php';
    require_once 'endpoints/users.php';
    // create an object.
    $u = new Users();
    $f = new FormTemplates();
    $p = new PersistedData();
    // first method call requests and stores the users WebToken (userId is passed in here).
    $userToken = $u->getUsersToken('5eefec33-ca71-e511-befe-98991b71acc0');
    // Now pass in a formTemplate revision id of the form you want returned, the persistedDataId
    // you want to fill out the form fields, and the userToken passed in from the previous method call.
    $p->postFormPdata('9d4d2408-1183-e511-bf05-9c4e36b08790','c054e3bb-bd4c-4185-8d45-cf062d369a66',$userToken);
    
    // RESPONSE
      
    http://demo.visualvault.com/VVlogin?token=e5dd1420-0d8e-e511-bf05-9c4e36b08790&returnUrl=~%2fFormDetails%3fformid%3d9d4d2408-1183-e511-bf05-
    9c4e36b08790%26persistedId%3dc054e3bb-bd4c-4185-8d45-cf062d369a66
        

An encoded URL is returned that you may use in your application as an anchor tag target, i-frame source, etc. This URL will render a Form Data 'Instance' using the Form Template