curl --request PATCH \
--url https://api.hightouch.com/api/v1/events/contracts/{contractId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"type": "track",
"name": "Checked Out",
"onUndeclaredFields": "BLOCK_EVENT",
"onSchemaViolation": "BLOCK_EVENT",
"schema": {
"type": "object",
"properties": {
"properties": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number"
}
}
}
}
}
}
]
}
'import requests
url = "https://api.hightouch.com/api/v1/events/contracts/{contractId}"
payload = { "events": [
{
"type": "track",
"name": "Checked Out",
"onUndeclaredFields": "BLOCK_EVENT",
"onSchemaViolation": "BLOCK_EVENT",
"schema": {
"type": "object",
"properties": { "properties": {
"type": "object",
"required": ["total"],
"properties": { "total": { "type": "number" } }
} }
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
type: 'track',
name: 'Checked Out',
onUndeclaredFields: 'BLOCK_EVENT',
onSchemaViolation: 'BLOCK_EVENT',
schema: {
type: 'object',
properties: {
properties: {type: 'object', required: ['total'], properties: {total: {type: 'number'}}}
}
}
}
]
})
};
fetch('https://api.hightouch.com/api/v1/events/contracts/{contractId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hightouch.com/api/v1/events/contracts/{contractId}",
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([
'events' => [
[
'type' => 'track',
'name' => 'Checked Out',
'onUndeclaredFields' => 'BLOCK_EVENT',
'onSchemaViolation' => 'BLOCK_EVENT',
'schema' => [
'type' => 'object',
'properties' => [
'properties' => [
'type' => 'object',
'required' => [
'total'
],
'properties' => [
'total' => [
'type' => 'number'
]
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hightouch.com/api/v1/events/contracts/{contractId}"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.hightouch.com/api/v1/events/contracts/{contractId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hightouch.com/api/v1/events/contracts/{contractId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "1",
"name": "My Contract",
"workspaceId": 1,
"events": [
{
"type": "track",
"name": "Checked Out",
"slug": "track-checked-out",
"version": "default",
"schema": {
"type": "object",
"required": [
"req"
],
"properties": {
"req": {
"type": "string"
}
},
"description": ""
},
"onSchemaViolation": "ALLOW_EVENT",
"onUndeclaredFields": "BLOCK_EVENT"
}
],
"onUndeclaredSchema": "BLOCK_EVENT",
"eventSources": [
{
"id": "1",
"name": "Marketing Site"
}
],
"createdAt": "2022-02-16T21:37:58.510Z",
"updatedAt": "2022-02-16T21:37:58.510Z"
}{
"message": "Validation failed",
"details": {}
}"Internal Server Error"Update an Event Contract
Update an existing event contract
Patch an event contract based on its Hightouch ID
curl --request PATCH \
--url https://api.hightouch.com/api/v1/events/contracts/{contractId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"type": "track",
"name": "Checked Out",
"onUndeclaredFields": "BLOCK_EVENT",
"onSchemaViolation": "BLOCK_EVENT",
"schema": {
"type": "object",
"properties": {
"properties": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number"
}
}
}
}
}
}
]
}
'import requests
url = "https://api.hightouch.com/api/v1/events/contracts/{contractId}"
payload = { "events": [
{
"type": "track",
"name": "Checked Out",
"onUndeclaredFields": "BLOCK_EVENT",
"onSchemaViolation": "BLOCK_EVENT",
"schema": {
"type": "object",
"properties": { "properties": {
"type": "object",
"required": ["total"],
"properties": { "total": { "type": "number" } }
} }
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
type: 'track',
name: 'Checked Out',
onUndeclaredFields: 'BLOCK_EVENT',
onSchemaViolation: 'BLOCK_EVENT',
schema: {
type: 'object',
properties: {
properties: {type: 'object', required: ['total'], properties: {total: {type: 'number'}}}
}
}
}
]
})
};
fetch('https://api.hightouch.com/api/v1/events/contracts/{contractId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hightouch.com/api/v1/events/contracts/{contractId}",
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([
'events' => [
[
'type' => 'track',
'name' => 'Checked Out',
'onUndeclaredFields' => 'BLOCK_EVENT',
'onSchemaViolation' => 'BLOCK_EVENT',
'schema' => [
'type' => 'object',
'properties' => [
'properties' => [
'type' => 'object',
'required' => [
'total'
],
'properties' => [
'total' => [
'type' => 'number'
]
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hightouch.com/api/v1/events/contracts/{contractId}"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.hightouch.com/api/v1/events/contracts/{contractId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hightouch.com/api/v1/events/contracts/{contractId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"type\": \"track\",\n \"name\": \"Checked Out\",\n \"onUndeclaredFields\": \"BLOCK_EVENT\",\n \"onSchemaViolation\": \"BLOCK_EVENT\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"properties\": {\n \"type\": \"object\",\n \"required\": [\n \"total\"\n ],\n \"properties\": {\n \"total\": {\n \"type\": \"number\"\n }\n }\n }\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "1",
"name": "My Contract",
"workspaceId": 1,
"events": [
{
"type": "track",
"name": "Checked Out",
"slug": "track-checked-out",
"version": "default",
"schema": {
"type": "object",
"required": [
"req"
],
"properties": {
"req": {
"type": "string"
}
},
"description": ""
},
"onSchemaViolation": "ALLOW_EVENT",
"onUndeclaredFields": "BLOCK_EVENT"
}
],
"onUndeclaredSchema": "BLOCK_EVENT",
"eventSources": [
{
"id": "1",
"name": "Marketing Site"
}
],
"createdAt": "2022-02-16T21:37:58.510Z",
"updatedAt": "2022-02-16T21:37:58.510Z"
}{
"message": "Validation failed",
"details": {}
}"Internal Server Error"Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
The input for updating a Contract
The contract's name
The contract's slug. If not specified, one will be generated.
The contract's description
What happens to events that aren't defined in the contract. One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to ALLOW_EVENT.
ALLOW_EVENT, BLOCK_EVENT The definitions for the events in the contract.
Show child attributes
Show child attributes
Response
Ok
The input for updating a Contract
The contract's name
The contract's slug. If not specified, one will be generated.
The contract's description
What happens to events that aren't defined in the contract. One of ALLOW_EVENT or BLOCK_EVENT. Optional, defaults to ALLOW_EVENT.
ALLOW_EVENT, BLOCK_EVENT The definitions for the events in the contract.
Show child attributes
Show child attributes
Was this page helpful?