Request Examples

Curl

curl -XDELETE \
--header 'Item8-Api-Key: 7c4a8d09ca3762af61e59520943dc26494f8941b' \
--header "Content-type: application/json" \
--data 'reason=qwerty' \
'https://api.CLIENT_ID.item8.io/v1/customers/1'

PHP

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.CLIENT_ID.item8.io/v1/customers/1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'reason=qwerty');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
$headers = [];
$headers[] = 'Item8-Api-Key: 7c4a8d09ca3762af61e59520943dc26494f8941b';
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close ($ch);
print_r(json_decode($result));

JavaScript

var request = require('request');
var headers = {
'Item8-Api-Key': '7c4a8d09ca3762af61e59520943dc26494f8941b',
'Content-type': 'application/json'
};
var dataString = 'reason=qwerty';
var options = {
url: 'https://api.CLIENT_ID.item8.io/v1/customers/1',
method: 'DELETE',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);

Python

import requests
headers = {
'Item8-Api-Key': '7c4a8d09ca3762af61e59520943dc26494f8941b',
'Content-type': 'application/json',
}
data = {
'reason': 'qwerty'
}
response = requests.delete('https://api.CLIENT_ID.item8.io/v1/customers/1', headers=headers, data=data)

GO

body := strings.NewReader(`reason=qwerty`)
req, err := http.NewRequest("DELETE", "https://api.CLIENT_ID.item8.io/v1/customers/1", body)
if err != nil {
// handle err
}
req.Header.Set("Item8-Api-Key", "7c4a8d09ca3762af61e59520943dc26494f8941b")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
// handle err
}
defer resp.Body.Close()