Customers
Update a customer
Changes the customer’s customer_id and/or its meta data. The status is changed through /customers/{id}/status/.
meta_data replaces the whole set: keys you leave out are deleted. A customer holds at most 20 meta data keys. A new customer_id that another customer in your account already has returns 400.
Fires Customer updated triggers (yours and the affiliate’s). Requires the Manage programs team permission. Returns 404 and 403 as for retrieving a customer.
PATCH
/
customers
/
{id}
/
Update a customer
curl --request PATCH \
--url https://api.tapfiliate.com/1.6/customers/{id}/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"customer_id": "USER456",
"meta_data": {
"buz": "baz"
}
}
'const options = {
method: 'PATCH',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_id: 'USER456', meta_data: {buz: 'baz'}})
};
fetch('https://api.tapfiliate.com/1.6/customers/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tapfiliate.com/1.6/customers/{id}/"
payload = {
"customer_id": "USER456",
"meta_data": { "buz": "baz" }
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tapfiliate.com/1.6/customers/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => 'USER456',
'meta_data' => [
'buz' => 'baz'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.tapfiliate.com/1.6/customers/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tapfiliate.com/1.6/customers/{id}/"
payload := strings.NewReader("{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tapfiliate.com/1.6/customers/{id}/")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}")
.asString();{
"id": "cu_eXampl3",
"customer_id": "USER456",
"status": "trial",
"created_at": "2021-07-02T09:55:20+00:00",
"click": {
"created_at": "2021-03-03T12:39:19+00:00",
"referrer": "https://example-blog.inc/check-out-johns-product/",
"landing_page": "https://tapper.inc/johns-cool-product/"
},
"program": {
"id": "johns-affiliate-program",
"title": "John's affiliate program",
"currency": "USD"
},
"affiliate": {
"id": "janejameson",
"firstname": "Jane",
"lastname": "Jameson"
},
"affiliate_meta_data": {
"subid1": "baz"
},
"meta_data": {
"buz": "baz"
},
"warnings": null
}{
"errors": [
{
"message": "Missing mandatory parameter(s)"
}
]
}{
"message": "Authentication Failed.",
"code": 401
}{
"message": "Forbidden",
"code": 403,
"traceId": "04ed655728a22bc0d39f"
}{
"message": "Not Found",
"code": 404,
"traceId": "7ae8e92b77572da03805"
}Body
application/json
⌘I
Update a customer
curl --request PATCH \
--url https://api.tapfiliate.com/1.6/customers/{id}/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"customer_id": "USER456",
"meta_data": {
"buz": "baz"
}
}
'const options = {
method: 'PATCH',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_id: 'USER456', meta_data: {buz: 'baz'}})
};
fetch('https://api.tapfiliate.com/1.6/customers/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tapfiliate.com/1.6/customers/{id}/"
payload = {
"customer_id": "USER456",
"meta_data": { "buz": "baz" }
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tapfiliate.com/1.6/customers/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => 'USER456',
'meta_data' => [
'buz' => 'baz'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.tapfiliate.com/1.6/customers/{id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tapfiliate.com/1.6/customers/{id}/"
payload := strings.NewReader("{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tapfiliate.com/1.6/customers/{id}/")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"USER456\",\n \"meta_data\": {\n \"buz\": \"baz\"\n }\n}")
.asString();{
"id": "cu_eXampl3",
"customer_id": "USER456",
"status": "trial",
"created_at": "2021-07-02T09:55:20+00:00",
"click": {
"created_at": "2021-03-03T12:39:19+00:00",
"referrer": "https://example-blog.inc/check-out-johns-product/",
"landing_page": "https://tapper.inc/johns-cool-product/"
},
"program": {
"id": "johns-affiliate-program",
"title": "John's affiliate program",
"currency": "USD"
},
"affiliate": {
"id": "janejameson",
"firstname": "Jane",
"lastname": "Jameson"
},
"affiliate_meta_data": {
"subid1": "baz"
},
"meta_data": {
"buz": "baz"
},
"warnings": null
}{
"errors": [
{
"message": "Missing mandatory parameter(s)"
}
]
}{
"message": "Authentication Failed.",
"code": 401
}{
"message": "Forbidden",
"code": 403,
"traceId": "04ed655728a22bc0d39f"
}{
"message": "Not Found",
"code": 404,
"traceId": "7ae8e92b77572da03805"
}