Difference between revisions of "Offerit REST API Delete Creative Rules"
From Offerit
OfferitRob (talk | contribs) (Created page with "{{Offerit Manual | show_api_admin_section = true }} == '''POST /creative/delete_creative_rule''' == '''Description''' *delete_creative_rule deletes creative rules '''Resourc...") |
Offeritnick (talk | contribs) (→POST /creative/delete_creative_rule) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Offerit Manual | {{Offerit Manual | ||
| − | | | + | | show_rest_api_section = true |
}} | }} | ||
== '''POST /creative/delete_creative_rule''' == | == '''POST /creative/delete_creative_rule''' == | ||
| Line 7: | Line 7: | ||
'''Resource URL''' | '''Resource URL''' | ||
| − | *<nowiki>http://domain/api/creative/ | + | *<nowiki>http://domain/api/creative/delete_creative_rule</nowiki> |
*Replace domain with the Offerit domain | *Replace domain with the Offerit domain | ||
| Line 75: | Line 75: | ||
); | ); | ||
$resp = curl_exec($curl); | $resp = curl_exec($curl); | ||
| − | //dumps an associative array representation of the json | + | //dumps an associative array representation of the json response |
| − | + | $output = json_decode($resp, true); | |
| + | if($output !== NULL) { | ||
| + | //json was valid. Dump the decoded array | ||
| + | print_r($output); | ||
| + | } | ||
| + | else { | ||
| + | //invalid json, just dump the raw response | ||
| + | print_r($resp); | ||
| + | } | ||
// Close request to clear up some resources | // Close request to clear up some resources | ||
curl_close($curl); | curl_close($curl); | ||
Latest revision as of 11:37, 26 August 2022
POST /creative/delete_creative_rule
Description
- delete_creative_rule deletes creative rules
Resource URL
- http://domain/api/creative/delete_creative_rule
- Replace domain with the Offerit domain
Response Format
- JSON
- POST
- HTTP headers
Parameters
- creativeids
- type: integer,string,array
- required
- creativeids for which you are deleting rules. accepts int, comma separated list of ints, array of ints.
- ruleids
- type: string,array
- required
- ruleids to delete. accepts string, comma separated list of strings, array of strings.
Example Request
POST
http://domain/api/creative/delete_creative_rule?creativeids=1&ruleids=57c738de72d59
- Response:
{
"successes": [
{
"creativeid": "13",
"ruleid": "57c738de72d59"
}
],
"failures": [],
"total_successes": 1
}
Example Code
PHP
<?php
$url = 'http://domain/api/creative/delete_creative_rule'
$curl = curl_init();
$headers = array(
'api-key: 44b5498dbcb481a0d00b404c0169af62',
'api-username: productsupport'
);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_URL, $url);
$data = Array(
'creativeids' => 1,
'ruleids' => '57c738de72d59'
);
$resp = curl_exec($curl);
//dumps an associative array representation of the json response
$output = json_decode($resp, true);
if($output !== NULL) {
//json was valid. Dump the decoded array
print_r($output);
}
else {
//invalid json, just dump the raw response
print_r($resp);
}
// Close request to clear up some resources
curl_close($curl);
?>