Using the Sharpspring API to find all the fields available. If an update of a custom field is required, using getFields is required to get the systemName of the custom field to be updated
function ns_ss_getfields(){
/*Sharpspring API Keys*/
$accountID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$secretKey = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY';
$limit = 500;
$offset = 0;
$method = 'getFields';
$params = array('where' => array(), 'limit' => $limit, 'offset' => $offset);
$requestID = session_id();
$data = array(
'method' => $method,
'params' => $params,
'id' => $requestID,
);
$queryString = http_build_query(array('accountID' => $accountID, 'secretKey' => $secretKey));
$url = "http://api.sharpspring.com/pubapi/v1/?$queryString";
$data = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data),
'Expect: '
));
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
echo $obj
}