curl --request POST \
--url 'https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": [
{
"active": true,
"id": 12
}
]
}
'import requests
url = "https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey="
payload = { "inputs": [
{
"active": True,
"id": 12
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({inputs: [{active: true, id: 12}]})
};
fetch('https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=', 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.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'active' => true,
'id' => 12
]
]
]),
CURLOPT_HTTPHEADER => [
"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.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey="
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"completedAt": "2020-04-17T02:19:26.283Z",
"results": [
{
"active": true,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.propertyChange",
"id": "1234",
"propertyName": "firstname",
"updatedAt": "2019-08-06T16:56:16.652Z"
},
{
"active": false,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.create",
"id": "4567",
"updatedAt": "2019-08-06T16:56:16.652Z"
}
],
"startedAt": "2020-04-17T02:19:26.256Z",
"status": "COMPLETE"
}{
"completedAt": "2020-04-17T02:19:26.283Z",
"errors": [
{
"category": "SUBSCRIPTION_ID_NOT_FOUND",
"context": {
"subscriptionIds": [
"4567"
]
},
"message": "Failed to find subscriptions by id `4567`. Try again using a different subscriptionId.",
"status": "error",
"subCategory": "SubscriptionErrors.SUBSCRIPTION_IDS_NOT_FOUND"
}
],
"numErrors": 1,
"results": [
{
"active": true,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.propertyChange",
"id": "1234",
"propertyName": "firstname",
"updatedAt": "2019-08-06T16:56:16.652Z"
}
],
"startedAt": "2020-04-17T02:19:26.256Z",
"status": "COMPLETE"
}{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}Batch create event subscriptions
Créer en lot des abonnements aux événements pour l’application spécifiée.
curl --request POST \
--url 'https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": [
{
"active": true,
"id": 12
}
]
}
'import requests
url = "https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey="
payload = { "inputs": [
{
"active": True,
"id": 12
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({inputs: [{active: true, id: 12}]})
};
fetch('https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=', 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.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'active' => true,
'id' => 12
]
]
]),
CURLOPT_HTTPHEADER => [
"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.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey="
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/webhooks/v3/{appId}/subscriptions/batch/update?hapikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"active\": true,\n \"id\": 12\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"completedAt": "2020-04-17T02:19:26.283Z",
"results": [
{
"active": true,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.propertyChange",
"id": "1234",
"propertyName": "firstname",
"updatedAt": "2019-08-06T16:56:16.652Z"
},
{
"active": false,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.create",
"id": "4567",
"updatedAt": "2019-08-06T16:56:16.652Z"
}
],
"startedAt": "2020-04-17T02:19:26.256Z",
"status": "COMPLETE"
}{
"completedAt": "2020-04-17T02:19:26.283Z",
"errors": [
{
"category": "SUBSCRIPTION_ID_NOT_FOUND",
"context": {
"subscriptionIds": [
"4567"
]
},
"message": "Failed to find subscriptions by id `4567`. Try again using a different subscriptionId.",
"status": "error",
"subCategory": "SubscriptionErrors.SUBSCRIPTION_IDS_NOT_FOUND"
}
],
"numErrors": 1,
"results": [
{
"active": true,
"createdAt": "2019-06-06T16:56:16.652Z",
"eventType": "contact.propertyChange",
"id": "1234",
"propertyName": "firstname",
"updatedAt": "2019-08-06T16:56:16.652Z"
}
],
"startedAt": "2020-04-17T02:19:26.256Z",
"status": "COMPLETE"
}{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}Supported products
Supported products
Autorisations
Paramètres de chemin
L'ID de l'application cible.
Corps
Updated details for the specified subscriptions.
Un tableau d'objets SubscriptionBatchUpdateRequest, chacun représentant les paramètres mis à jour pour un abonnement de webhook spécifique dans l'opération par lot.
Show child attributes
Show child attributes
Réponse
successful operation
L'horodatage de la fin de l'opération par lots, au format ISO 8601.
Un tableau contenant les abonnements de webhook traités avec succès à partir de l'opération par lot.
Show child attributes
Show child attributes
L'horodatage du début du traitement de l'opération par lot, au format ISO 8601.
Le statut de l'opération par lot. Les valeurs acceptées sont « PENDING », « PROCESSING », « CANCELED » ou « COMPLETE ».
CANCELED, COMPLETE, PENDING, PROCESSING Un objet contenant les URL des ressources ou opérations associées.
Show child attributes
Show child attributes
L'horodatage de la demande d'opération par lot, au format ISO 8601.