-
Notifications
You must be signed in to change notification settings - Fork 29
HTTP Method Helpers
donclem edited this page Aug 2, 2012
·
3 revisions
HTTP Method Helpers are the newest addition to the PHP Client. They allow a generalized calling of the four services we allow in the Spark API. It is currently available for a get
, post
, put
, and delete
. Each event is documented within Core.php file on what $options
can hold and use.
#Example // Get Saved Searches $resultgettest = $api->get("savedsearches", $options = array()); if ($resultgettest === false) { echo "API Error Code: {$api->last_error_code}\n"; echo "API Error Message: {$api->last_error_mess}\n"; exit; } else { print_r($resultgettest); }
// Post New Saved Search
$resultposttest = $api->post("savedsearches", $options = array("data" => array("Name" => "PostTestSavedSearch", "Filter" => "City Eq 'Fargo'")));
if ($resultposttest === false) {
echo "API Error Code: {$api->last_error_code}\n";
echo "API Error Message: {$api->last_error_mess}\n";
exit;
} else {
print_r($resultposttest);
}
// Put Saved Search Update
$resultputtest = $api->put("savedsearches/20110314222417421851000000", $options = array("data" => array("Name" => "PostTestSavedSearch2", "Filter" => "City Eq 'West Fargo'")));
if ($resultputtest === false) {
echo "API Error Code: {$api->last_error_code}\n";
echo "API Error Message: {$api->last_error_mess}\n";
exit;
} else {
print_r($resultputtest);
}
// Delete Saved Search
$resultdeletetest = $api->delete("savedsearches/20110314221916966126000000", $options = array());
if ($resultdeletetest === false) {
echo "API Error Code: {$api->last_error_code}\n";
echo "API Error Message: {$api->last_error_mess}\n";
exit;
} else {
print_r($resultdeletetest);
}
#Spark Platform Documentation Saved Searches Documentation for Spark API