Update a subscription
curl --request PUT \
--url https://external.pleo.io/v1/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"endpointUrl": "https://example.com/webhook",
"eventTypes": [
"v1.export-job.created"
],
"customHeaders": {
"user": "pass"
},
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
},
"status": "ACTIVE"
}
'import requests
url = "https://external.pleo.io/v1/subscriptions/{id}"
payload = {
"endpointUrl": "https://example.com/webhook",
"eventTypes": ["v1.export-job.created"],
"customHeaders": { "user": "pass" },
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
},
"status": "ACTIVE"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify({
endpointUrl: 'https://example.com/webhook',
eventTypes: ['v1.export-job.created'],
customHeaders: {user: 'pass'},
endpointAuth: {
credentials: {password: 'password', token: 'token', username: 'username'},
type: 'NONE'
},
status: 'ACTIVE'
})
};
fetch('https://external.pleo.io/v1/subscriptions/{id}', 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://external.pleo.io/v1/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'endpointUrl' => 'https://example.com/webhook',
'eventTypes' => [
'v1.export-job.created'
],
'customHeaders' => [
'user' => 'pass'
],
'endpointAuth' => [
'credentials' => [
'password' => 'password',
'token' => 'token',
'username' => 'username'
],
'type' => 'NONE'
],
'status' => 'ACTIVE'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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://external.pleo.io/v1/subscriptions/{id}"
payload := strings.NewReader("{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://external.pleo.io/v1/subscriptions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.pleo.io/v1/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"createdAt": "2022-01-01T00:00:00Z",
"endpointUrl": "https://example.com/webhook",
"eventTypes": "v1.export-job.created",
"id": "123e4567-e89b-12d3-a456-426614174000",
"status": "ACTIVE",
"updatedAt": "2022-01-10T00:00:00Z",
"customHeaders": {
"user": "pass"
},
"deletedAt": "2022-01-01T00:00:00Z",
"deletedBy": "urn:pleo:organisation:12345678-1234-1234-1234-123456789012",
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
}
}
}"Bad Request""The subscription record could not be found.""Could not update the subscription record owing to infrastructure issue. Please try after some time. If the problem persists, reach out to Pleo customer support."Subscriptions
Update a subscription
Modifies the subscription details.
PUT
/
v1
/
subscriptions
/
{id}
Update a subscription
curl --request PUT \
--url https://external.pleo.io/v1/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"endpointUrl": "https://example.com/webhook",
"eventTypes": [
"v1.export-job.created"
],
"customHeaders": {
"user": "pass"
},
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
},
"status": "ACTIVE"
}
'import requests
url = "https://external.pleo.io/v1/subscriptions/{id}"
payload = {
"endpointUrl": "https://example.com/webhook",
"eventTypes": ["v1.export-job.created"],
"customHeaders": { "user": "pass" },
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
},
"status": "ACTIVE"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify({
endpointUrl: 'https://example.com/webhook',
eventTypes: ['v1.export-job.created'],
customHeaders: {user: 'pass'},
endpointAuth: {
credentials: {password: 'password', token: 'token', username: 'username'},
type: 'NONE'
},
status: 'ACTIVE'
})
};
fetch('https://external.pleo.io/v1/subscriptions/{id}', 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://external.pleo.io/v1/subscriptions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'endpointUrl' => 'https://example.com/webhook',
'eventTypes' => [
'v1.export-job.created'
],
'customHeaders' => [
'user' => 'pass'
],
'endpointAuth' => [
'credentials' => [
'password' => 'password',
'token' => 'token',
'username' => 'username'
],
'type' => 'NONE'
],
'status' => 'ACTIVE'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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://external.pleo.io/v1/subscriptions/{id}"
payload := strings.NewReader("{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://external.pleo.io/v1/subscriptions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.pleo.io/v1/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"endpointUrl\": \"https://example.com/webhook\",\n \"eventTypes\": [\n \"v1.export-job.created\"\n ],\n \"customHeaders\": {\n \"user\": \"pass\"\n },\n \"endpointAuth\": {\n \"credentials\": {\n \"password\": \"password\",\n \"token\": \"token\",\n \"username\": \"username\"\n },\n \"type\": \"NONE\"\n },\n \"status\": \"ACTIVE\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"createdAt": "2022-01-01T00:00:00Z",
"endpointUrl": "https://example.com/webhook",
"eventTypes": "v1.export-job.created",
"id": "123e4567-e89b-12d3-a456-426614174000",
"status": "ACTIVE",
"updatedAt": "2022-01-10T00:00:00Z",
"customHeaders": {
"user": "pass"
},
"deletedAt": "2022-01-01T00:00:00Z",
"deletedBy": "urn:pleo:organisation:12345678-1234-1234-1234-123456789012",
"endpointAuth": {
"credentials": {
"password": "password",
"token": "token",
"username": "username"
},
"type": "NONE"
}
}
}"Bad Request""The subscription record could not be found.""Could not update the subscription record owing to infrastructure issue. Please try after some time. If the problem persists, reach out to Pleo customer support."Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the subscription
Body
application/json;charset=UTF-8
Update Subscription request
The URL where the events should be sent
Example:
"https://example.com/webhook"
Name of the event types you wish to subscribe to. Possible values can be found in the EventType enum.
Name of the event types you wish to subscribe to. Possible values can be found in the EventType enum.
Example:
["v1.export-job.created"]
Key values as headers to be sent to the webhooks vendor
Show child attributes
Show child attributes
Example:
{ "user": "pass" }
Authentication details for the endpoint
Show child attributes
Show child attributes
Status of subscription
Available options:
INACTIVE, ACTIVE Example:
"ACTIVE"
Response
Subscription updated.
Show child attributes
Show child attributes