REST API v4: PUT couponcampaigns
This method is used to create a new coupon campaign with the REST API. It uses an HTTP PUT request to the following address:
https://api.copernica.com/v4/couponcampaign/$id
After a successful call the ID of the created request is returned.
Available parameters
- name: name of the new coupon campaign
- description: optional description of the coupon campaign
- archived: optional boolean value to archive the coupon campaign upon creation
- tags: optional array with tags for the coupon campaign
JSON example
{
"name" : "Test campaign",
"description" : "This is a test campaign"
}
PHP example
The following PHP script demonstrates how to use the API method:
// dependencies
require_once('copernica-rest-api.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// data to be sent to the api
$data = array(
'name' => 'Test campaign',
'description' => 'This is a test campaign'
);
// do the call
$api->put("couponcampaign/$id", $data);
// return id of created request if successful
The example above requires the CopernicaRestApi class.