Coupontools Logo

API & Webhooks

Connect the Coupontools platform with your apps or web projects. The Coupontools REST API allows you to query meta-data about your account, campaigns, distribution, validations, and usage data.

Update the data from multipe campaign sessions

Allows you to update the data from multipe campaign sessions. For example to set one coupon session to open or voided status.
Base URL
POST: https://api4coupons.com/v3/batch/update
Parameters
# Parameter Input Description
1 client_id API client ID Can be found in your API documentation
Required
2 client_secret API client secret Can be found in your API documentation
Required
3 startsequence The sequence id of the first session Is returned in multiplesingleuse/create.
Optional
4 endsequence The sequence id of the last session Is returned in multiplesingleuse/create.
Optional
5 campaign The unique ID from the campaign Can be found in the list of all campaigns.
Required
6 operation void
unvoid
lock
unlock
claim
activate
Void will set the coupon session to voided status
Unvoid will unset the voided status
Lock will set the coupon session to locked status
Ulock will unset the unlocked status
Claim will unvoid and start the session, if the coupon has a flexible expiry date, the expiration time will be calculated.
Activate will unvoid and start the session, if the coupon has a flexible expiry date, the expiration time will be calculated.
Optional
7 customfield1 - customfield7 User defined fields
Optional
<?php
	$ch = curl_init();
	$url = "https://api4coupons.com/v3/batch/update";
	$client_id = "XXX"; // Your API client ID (required)
	$client_secret = "YYY"; // Your API client secret (required)
	$data = [
		'campaign' => "cam_123456"
	];
	curl_setopt($ch, CURLOPT_URL, "$url");
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_VERBOSE, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, [
		"X-Client-Id: $client_id",
		"X-Client-Secret: $client_secret",
		"Content-Type: application/json",
	]);
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
	$response = curl_exec($ch);
?>

You can't provide both startsessionid and startsequence or both endsessionid and endsequence.

Example response
				{
					"status": {
						"status": "OK"
					},
					"action_date": "2019-04-10 11:35:36",
					"action_quantity": 3
				}
				
Example error response
				{
					"status": {
						"status": "failed",
						"errors": {
							"error_message": "HTTP/1.1 422 Unprocessable entity.",
							"error_message_description": [
								"Some session(s) where already voided."
							],
							"error_code": [
								355
							]
						}
					}
				}
				
If one row fails nothing will be changed.
Possible errors
  • 200: no operation or data provided
  • 200: startsequence or endsequence not provided
  • 300: You can't use both startsessionid and startsequence
  • 300: You can't use both endsessionid and endsequence
  • 301: start sequence must be numeric
  • 301: end sequence must be numeric
  • 302: status invalid, valid statusses are: "
  • 302: Parameter test can only be true or false.
  • 351: Some session(s) are expired.
  • 352: Some session(s) where already claimed.
  • 354: Some session(s) where already locked.
  • 355: Some session(s) are void.
  • 355: Some session(s) could not be claimed becouse they're voided.
  • 355: Some session(s) where already voided.
  • 355: Some session(s) where voided.
  • 356: Some session(s) wheren't locked.
  • 357: Some session(s) weren't void.
  • 357: Some session(s) wheren't voided.
  • 358: Some session(s) where already validated.
  • 359: Some session(s) where not claimed.
  • 360: Some session(s) or coupon has not reached startdate yet
  • 361: Max coupons exceeded
  • 502: Provided start and end are not of the provided campaign.
  • 502: Provided start and end are not of the same campaign.
  • 513: End ID comes before start ID.
  • 513: End ID not found
  • 513: End ID not found or not part of the campaign
  • 513: Start ID not found
  • 513: Start ID not found or not part of the campaign

  • Inscrivez-vous pour un compte d'essai de 7 jours

    Commencez à utiliser Coupontools dès aujourd'hui !

C'est bien que vous soyez ici ! Des cookies ? Lisez notre déclaration de confidentialité. J'accepte
x