NAV Navbar
php csharp javascript ruby python
API v1 | API v2

Gift Certificates

Gift Certificates

Create a Gift Certificate

To create a Gift Certificate in the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_POSTFIELDS, "{
  \"CertificateCode\": \"\",
  \"Amount\": 0,
  \"Notes\": \"\"
}");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

    using (var content = new StringContent("{  \"CertificateCode\": \"\",  \"Amount\": 0,  \"Notes\": \"\"}", System.Text.Encoding.Default, "application/json"))
    {
      using (var response = await httpClient.PostAsync("3dCartWebAPI/v2/GiftCertificates", content))
      {
        string responseData = await response.Content.ReadAsStringAsync();
      }
  }
}
var request = new XMLHttpRequest();

request.open('POST', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

var body = {
  'CertificateCode': '',
  'Amount': 0,
  'Notes': ''
};

request.send(JSON.stringify(body));
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

values = '{
  "CertificateCode": "",
  "Amount": 0,
  "Notes": ""
}'

headers = {
  :content_type => 'application/json',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.post 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates', values, headers
puts response
from urllib2 import Request, urlopen

values = """
  {
    "CertificateCode": "",
    "Amount": 0,
    "Notes": ""
  }
"""

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates', data=values, headers=headers)

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

[
  {
    "Key":"CertificateCode",
    "Value":"1234",
    "Status":"201",
    "Message":"Created successfully",
  }
]

This method is used to create a new Gift Certificate in the system. See Object Definitions for more information on the GiftCertificate object.

HTTP Request

POST https://apirest.3dcart.com/3dCartWebAPI/v2/GiftCertificates

Responses and Errors

Response Code Description
201 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.

Retrieve a list of Gift Certificates

To retrieve a list of Gift Certificates from the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates?limit=&offset=&countonly=&notetext=&amountfrom=&amountto=&balancefrom=&balanceto=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/xml",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

  using(var response = await httpClient.GetAsync("3dCartWebAPI/v2/GiftCertificates"))
  {

        string responseData = await response.Content.ReadAsStringAsync();
  }
}
var request = new XMLHttpRequest();

request.open('GET', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates?limit=&offset=&countonly=&notetext=&amountfrom=&amountto=&balancefrom=&balanceto=');

request.setRequestHeader('Content-Type', 'application/xml');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

headers = {
  :content_type => 'application/xml',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.get 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates?limit=&offset=&countonly=&notetext=&amountfrom=&amountto=&balancefrom=&balanceto=', headers
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/xml',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates?limit=&offset=&countonly=&notetext=&amountfrom=&amountto=&balancefrom=&balanceto=', headers=headers)

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

[
  {
    "CertificateCode": "1234",
    "Amount": -100000000,
    "Balance": -100000000,
    "TotalSpent": -100000000,
    "DateCreated": "2019-11-27T17:51:30.494Z",
    "Notes": ""
  },
  {
    "CertificateCode": "5678",
    "Amount": -100000000,
    "Balance": -100000000,
    "TotalSpent": -100000000,
    "DateCreated": "2019-11-27T17:51:30.494Z",
    "Notes": ""
  }
]

This method is used to retrieve a list of gift certificates from the store. See Object Definitions for more information on the GiftCertificate object.

URL Parameters

Parameter Required Description
limit optional Maximum number of items that can be returned
offset optional Starting point for the return data
countonly optional Count the number of rows only
notetext optional Text to filter the notes field
amountfrom optional Retrieve gift certificates over this amount
amountto optional Retrieve gift certificates under this amount
balancefrom optional Retrieve gift certificates over this balance
balanceto optional Retrieve gift certificates under this balance

Responses and Errors

Response Code Description
200 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.
404 No gift certificates found.

Retrieve a specific Gift Certificate by code

To retrieve a specific Gift Certificate from the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

  using(var response = await httpClient.GetAsync("3dCartWebAPI/v2/GiftCertificates/{certificatecode}"))
  {

        string responseData = await response.Content.ReadAsStringAsync();
  }
}
var request = new XMLHttpRequest();

request.open('GET', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

headers = {
  :content_type => 'application/json',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.get 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers=headers)

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

{
  "CertificateCode": "1234",
  "Amount": -100000000,
  "Balance": -100000000,
  "TotalSpent": -100000000,
  "DateCreated": "2019-11-27T17:51:30.501Z",
  "Notes": ""
}

This method is used to retrieve a specific gift certificate. See Object Definitions for more information on the GiftCertificate object.

URL Parameters

Parameter Required Description
certificatecode required The specific certificate code requested.

Responses and Errors

Response Code Description
200 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.
404 The gift certificate was not found.

Update a list of Gift Certificates

To update a list of gift certificates in the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

curl_setopt($ch, CURLOPT_POSTFIELDS, "[
  {
    \"CertificateCode\": \"\",
    \"Amount\": 0,
    \"Notes\": \"\"
  }
]");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

    using (var content = new StringContent("[  {    \"CertificateCode\": \"\",    \"Amount\": 0,    \"Notes\": \"\"  }]", System.Text.Encoding.Default, "application/json"))
    {
      using (var response = await httpClient.PutAsync("3dCartWebAPI/v2/GiftCertificates", content))
      {
        string responseData = await response.Content.ReadAsStringAsync();
      }
  }
}
var request = new XMLHttpRequest();

request.open('PUT', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

var body = [
  {
    'CertificateCode': '',
    'Amount': 0,
    'Notes': ''
  }
];

request.send(JSON.stringify(body));
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

values = '[
  {
    "CertificateCode": "",
    "Amount": 0,
    "Notes": ""
  }
]'

headers = {
  :content_type => 'application/json',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.put 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates', values, headers
puts response
from urllib2 import Request, urlopen

values = """
  [
    {
      "CertificateCode": "",
      "Amount": 0,
      "Notes": ""
    }
  ]
"""

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates', data=values, headers=headers)
request.get_method = lambda: 'PUT'

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

[
  {
    "Key": "CertificateCode",
    "Value": "1234",
    "Status": "200",
    "Message": "Updated successfully"
  }
]

This method is used to update multiple gift certificates. See Object Definitions for more information on the GiftCertificate object.

Responses and Errors

Response Code Description
200 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.
404 The gift certificate was not found.

Update a specific Gift Certificate by code

To update a specific gift certificate in the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/xml",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

    using (var content = new StringContent("", System.Text.Encoding.Default, "application/xml"))
    {
      using (var response = await httpClient.PutAsync("3dCartWebAPI/v2/GiftCertificates/{certificatecode}", content))
      {
        string responseData = await response.Content.ReadAsStringAsync();
      }
  }
}
var request = new XMLHttpRequest();

request.open('PUT', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}');

request.setRequestHeader('Content-Type', 'application/xml');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

headers = {
  :content_type => 'application/xml',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.put 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/xml',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers=headers)
request.get_method = lambda: 'PUT'

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

[
  {
    "Key": "CertificateCode",
    "Value": "1234",
    "Status": "200",
    "Message": "Updated successfully"
  }
]

This method is used to update a specific gift certificate. See Object Definitions for more information on the GiftCertificate object.

URL Parameters

Parameter Required Description
certificatecode required The specific certificate code to update.

Responses and Errors

Response Code Description
200 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.
404 The gift certificate was not found.

Delete a Gift Certificate

To delete a gift certificate from the store, use the code below. Make sure to add your Secure URL, Private Key, and Token as described in Authentication.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Accept: application/json",
  "SecureURL: ",
  "PrivateKey: ",
  "Token: "
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;

var baseAddress = new Uri("https://apirest-dev.3dcart.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{


  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("secureurl", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("privatekey", "");

  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("token", "");

  using(var response = await httpClient.DeleteAsync("3dCartWebAPI/v2/GiftCertificates/{certificatecode}"))
  {

        string responseData = await response.Content.ReadAsStringAsync();
  }
}
var request = new XMLHttpRequest();

request.open('DELETE', 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('SecureURL', '');
request.setRequestHeader('PrivateKey', '');
request.setRequestHeader('Token', '');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

headers = {
  :content_type => 'application/json',
  :accept => 'application/json',
  :secureurl => '',
  :privatekey => '',
  :token => ''
}

response = RestClient.delete 'https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'SecureURL': '',
  'PrivateKey': '',
  'Token': ''
}
request = Request('https://apirest-dev.3dcart.com/3dCartWebAPI/v2/GiftCertificates/{certificatecode}', headers=headers)
request.get_method = lambda: 'DELETE'

response_body = urlopen(request).read()
print response_body

The above request will receive a response with JSON structured like this:

[
  {
    "Key": "CertificateCode",
    "Value": "1234",
    "Status": "200",
    "Message": "Deleted successfully"
  }
]

This method is used to delete a gift certificate.

Responses and Errors

Response Code Description
200 Successful response code.
400 Bad request. Check request headers/parameters/body for errors.
401 Authentication failure. The PrivateKey/Token/SecureURL combination is invalid, or the application scope does not have the correct read/write privileges.
404 The gift certificate was not found.