Objectives

Retrieve an Objective

GET /v1/{access-token}/objective
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);
 
$api->Get('objective')
    ->Where([
        'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
    ])
    ->As('GetObjective');

 
                            
                            
{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
    "label": "Contact Us",
    "properties": {
        "fname": {
            "value": "yes"
        },
        "lname": {
            "value": "yes"
        },
        "email": {
            "value": "yes",
            "confirmed": "yes"
        },
        "mobile": {
            "value": "yes",
            "confirmed": "yes"
        }
    },
    "obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
    "email": null,
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": ""
    },
    "notificationmethod": "email",
    "limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
    "lastused": "2019-02-27 12:11:00",
    "created": "2019-02-27 12:11:00"
}
                            

Finding Objectives

GET /v1/{access-token}/objectives
                            
use \FormSynergy\Init as FS;

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

$api->Find('objectives')
    ->Where([
        'modid' => $modid
    ])
    ->As('FindObjectives');

 
                            
                            
[{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
    "label": "Contact Us",
    "properties": {
        "fname": {
            "value": "yes"
        },
        "lname": {
            "value": "yes"
        },
        "email": {
            "value": "yes",
            "confirmed": "yes"
        },
        "mobile": {
            "value": "yes",
            "confirmed": "yes"
        }
    },
    "obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
    "email": null,
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": ""
    },
    "notificationmethod": "email",
    "limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
    "lastused": "2019-02-27 12:11:00",
    "created": "2019-02-27 12:11:00"
},
{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
    "label": "Order Form",
    "properties": {
        "fname": {
            "value": "yes"
        },
        "lname": {
            "value": "yes"
        },
        "email": {
            "value": "yes",
            "confirmed": "yes"
        },
        "mobile": {
            "value": "yes",
            "confirmed": "yes"
        },
        "product": {
            "value": "yes",
            "confirmed": "no",
            "count": 1
        }
    },
    "obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
    "email": null,
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": ""
    },
    "notificationmethod": "email",
    "limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
    "lastused": "2019-02-27 12:11:00",
    "created": "2019-02-27 12:11:00"
}]
                            

Create an Objective

POST /v1/{access-token}/objective
                            
use \FormSynergy\Init as FS;

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

$api->Find('websites')
    ->Where([
        'domain' => 'demo......com'
    ])
    ->As('websites', 0);
 
$api->Find('strategies')
    ->Where([
        'modid' => $api->_website('activestrategy')
    ])
    ->As('strategy', 0);
 
$api->Find('modules')
    ->Where([
        'modid' => $api->_strategy('modid'),
        'name' => 'Contact Us'
    ])
    ->As('ContactForm', 0);

$api->Create('objective')
    ->Attributes([
        'siteid' => $api->_strategy('siteid'),
        'modid' => $api->_strategy('modid'),
        'label' => $api->_ContactForm('name'),
        'properties' => [
            'fname' => [
                'value' => 'yes'
            ],
            'lname' => [
                'value' => 'yes'
            ],
            'email' => [
                'value' => 'yes',
                'confirmed' => 'yes'
            ],
            'mobile' => [
                'value' => 'yes',
                'confirmed' => 'yes'
            ]
        ],
        'limittomodule' => $api->_ContactForm('moduleid'),
        'notificationmethod' => 'email',
        'recipient' => [
            'fname' => 'Jhon',
            'lname' => 'Smith',
            'email' => 'jsmith@demo.interactionapi.com',
            'format' => 'default'
        ],
        'leadboard' => 'yes',
        'endpoint' => [
            'url' => '',
        ]  
    ])
    ->As('CreateObjective');

 
                            
                            
{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
    "label": "Contact Us",
    "properties": {
        "fname": {
            "value": "yes"
        },
        "lname": {
            "value": "yes"
        },
        "email": {
            "value": "yes",
            "confirmed": "yes"
        },
        "mobile": {
            "value": "yes",
            "confirmed": "yes"
        }
    },
    "obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
    "email": null,
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": ""
    },
    "notificationmethod": "email",
    "limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
    "lastused": "2019-02-27 12:11:00",
    "created": "2019-02-27 12:11:00"
}
                            

Update Objective Properties

PUT /v1/{access-token}/objective
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);
 
$api->Get('objective')
    ->Where([
        'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
    ])
    ->Update([
        'properties' => [
            'email' => [
                'value' => 'yes',
                'confirmed' => 'no'
            ]
        ],
        'leadboard' => 'yes',
        'notificationmethod' => 'webhook',
        'endpoint' => [
            'url' => 'https://...'
        ]
    ])
    ->As('UpdateObjective');

 
                            
                            
{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "mod-a34c88eebfa6df727961ba198d204104",
    "label": "Objectve 1",
    "properties": {
        "email": {
            "value": "yes",
            "confirmed": "no"
        }
    },
    "obsid": "obsid-9c16004e7a76a963ee4eb3147febcf15",
    "email": "yes",
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": "https:\/\/..."
    },
    "notificationmethod": "webhook",
    "limittomodule": "no",
    "lastused": null,
    "created": null
}
                            

Replace Objective Properties

PUT /v1/{access-token}/objective
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);
 
$api->Get('objective')
    ->Where([
        'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
    ])
    ->Replace([
        'properties' => [
            'email' => [
                'value' => 'yes',
                'confirmed' => 'no'
            ]
        ],
        'notificationmethod' => 'webhook',
        'endpoint' => [
            'url' => 'https://...'
        ]
    ])
    ->As('ReplaceObjective');

 
                            
                            
{
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
    "modid": "mod-a34c88eebfa6df727961ba198d204104",
    "label": "Objectve 1",
    "properties": {
        "email": {
            "value": "yes",
            "confirmed": "no"
        }
    },
    "obsid": "obsid-9c16004e7a76a963ee4eb3147febcf15",
    "email": "yes",
    "recipient": {
        "fname": "Jhon",
        "lname": "Smith",
        "email": "jsmith@demo......com"
    },
    "endpoint": {
        "url": "https:\/\/..."
    },
    "notificationmethod": "webhook",
    "limittomodule": "no",
    "lastused": null,
    "created": null
}
                            

Delete an Objective

DELETE /v1/{access-token}/objective
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);
 
$api->Get('objective')
    ->Where([
        'obsid' => $obsid,
    ])->Delete()
    ->As('DeleteObjective');
 
 
                            
                            
{
    "code": 200,
    "messages": ["Item removed"],
    "AccessPoint": "754a3683204940fd0f6ac39b25d127e3",
    "profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
    "uri": "\/v1\/754a3683204940fd0f6ac39b25d127e3\/objective"
}