Data

Retrieve data

GET /v1/{access-token}/data, /v1/{access-token}/lead
                             
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

// Create a new resource storage for 'data'
$resource = FS::Resource('data');

// Get will return a single entry.
$api->Get('data')
    ->Where([
        'userid' => $userid,
    ])
    ->As('user');

// Store retrieved data in resource storage as user
$resource->Store( 'user' )->Data( $api->_user() );
 
                            
                            
{
    "profileid": "profile-c2300300a5075ee8adae51da57c39f90",
    "userid": "8a728915ee50fddb022b0bde78b114a0cbdc48f2b4...",
    "fname": {
        "itemindex": "228",
        "value": "Jhon",
        "confirmed": "no"
    },
    "lname": {
        "itemindex": "229",
        "value": "Smith",
        "confirmed": "no"
    },
    "mobile": {
        "itemindex": "230",
        "value": "(000) 000-0000",
        "confirmed": "yes"
    },
    "email": {
        "itemindex": "231",
        "value": "jsmith@demo.....com",
        "confirmed": "yes"
    },
    "address": {
        "itemindex": "232",
        "value": "000 street st, City, CA, USA",
        "confirmed": "yes"
    }
}
                            

Finding data

GET /v1/{access-token}/data, /v1/{access-token}/leads
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

// Create a new resource storage for 'data'
$resource = FS::Resource('data');

// Find will return multiple entries    
$api->Find('data')
    ->Where([
        'fname' => 'joe',
    ])
    ->As('leads');
// Store retrieved data in resource storage as lead
$resource->Store( 'lead' )->Data( $api->_leads() );


// Find will return multiple entries   
$api->Find('data')
    ->Where([
        'fname' => 'joe', 
    ])
    // To pick one entry, 0 for the first one. 
    ->As('oneLead', 0);
// Store retrieved data in resource storage as lead
$resource->Store( 'lead' )->Data( $api->_oneLeads() );
 
                            
                            
// All leads/data
[{
    "profileid": "profile-c2300300a5075ee8adae51da57c39f90",
    "userid": "8a728915ee50fddb022b0bde78b114a0cbdc48f2b4...",
    "fname": {
        "itemindex": "228",
        "value": "Jhon",
        "confirmed": "no"
    },
    "lname": {
        "itemindex": "229",
        "value": "Smith",
        "confirmed": "no"
    },
    "mobile": {
        "itemindex": "230",
        "value": "(000) 000-0000",
        "confirmed": "yes"
    },
    "email": {
        "itemindex": "231",
        "value": "jsmith@demo.....com",
        "confirmed": "yes"
    },
    "address": {
        "itemindex": "232",
        "value": "000 street st, City, CA, USA",
        "confirmed": "yes"
    }
}, {
    "profileid": "profile-c2300300a5075ee8adae51da57c39f90",
    "userid": "b27ed1e6ffb23108cbc55f6d1ecb12e76aa2e058d2e45aaa76a705249a2d3...",
    "Specialty Services": {
        "itemindex": "233",
        "value": "Personal Inventory, Other Service, ...",
        "confirmed": "no"
    },
    "fname": {
        "itemindex": "234",
        "value": "John",
        "confirmed": "no"
    },
    "lname": {
        "itemindex": "235",
        "value": "Doe",
        "confirmed": "no"
    },
    "mobile": {
        "itemindex": "236",
        "value": "(000) 000-0000",
        "confirmed": "yes"
    },
    "email": {
        "itemindex": "237",
        "value": "jdoe@demo.....com",
        "confirmed": "yes"
    },
    "address": {
        "itemindex": "238",
        "value": "000 street st, City, CA, USA",
        "confirmed": "yes"
    }
}]

// The first lead
{
    "profileid": "profile-c2300300a5075ee8adae51da57c39f90",
    "userid": "8a728915ee50fddb022b0bde78b114a0cbdc48f2b4...",
    "fname": {
        "itemindex": "228",
        "value": "Jhon",
        "confirmed": "no"
    },
    "lname": {
        "itemindex": "229",
        "value": "Smith",
        "confirmed": "no"
    },
    "mobile": {
        "itemindex": "230",
        "value": "(000) 000-0000",
        "confirmed": "yes"
    },
    "email": {
        "itemindex": "231",
        "value": "jsmith@demo.....com",
        "confirmed": "yes"
    },
    "address": {
        "itemindex": "232",
        "value": "000 street st, City, CA, USA",
        "confirmed": "yes"
    }
}