Skip to content

Commit

Permalink
CTC-2213 Adjust webhook samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jancerman committed Dec 14, 2023
1 parent 8b6f931 commit 85baf0c
Show file tree
Hide file tree
Showing 21 changed files with 147 additions and 107 deletions.
2 changes: 1 addition & 1 deletion js/management-api-v2/cm_api_v2_delete_legacy_webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const client = new ManagementClient({

const response = await client.deleteWebhook()
.byId("d53360f7-79e1-42f4-a524-1b53a417d03e")
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/management-api-v2/cm_api_v2_get_legacy_webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const client = new ManagementClient({

const response = await client.getWebhook()
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990")
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/management-api-v2/cm_api_v2_get_legacy_webhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const client = new ManagementClient({
});

const response = await client.listWebhooks()
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/management-api-v2/cm_api_v2_post_legacy_webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ const response = await client.addWebhook()
}
}
)
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/management-api-v2/mapi_v2_disable_legacy_webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const client = new ManagementClient({

const response = await client.disableWebhook()
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990")
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/management-api-v2/mapi_v2_enable_legacy_webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const client = new ManagementClient({

const response = await client.enableWebhook()
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990")
.toPromise();
.toPromise();
2 changes: 1 addition & 1 deletion js/using-webhooks/legacy_webhooks_validate_signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const isValidSignature = (req, secret) => {
secret,
req.headers['x-kc-signature']
);
};
};
2 changes: 1 addition & 1 deletion js/using-webhooks/webhooks_validate_signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const isValidSignature = (req, secret) => {
secret,
req.headers['x-kontent-ai-signature']
);
};
};
1 change: 0 additions & 1 deletion net/management-api-v2/cm_api_v2_post_legacy_webhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,3 @@
},
}
});

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request DELETE \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks/d53360f7-79e1-42f4-a524-1b53a417d03e \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/cm_api_v2_delete_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request DELETE \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks-vnext/d53360f7-79e1-42f4-a524-1b53a417d03e \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/cm_api_v2_get_legacy_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request GET \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks/5df74e27-1213-484e-b9ae-bcbe90bd5990 \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/cm_api_v2_get_legacy_webhooks.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request GET \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/cm_api_v2_get_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request GET \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks-vnext/5df74e27-1213-484e-b9ae-bcbe90bd5990- \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/cm_api_v2_get_webhooks.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request GET \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks-vnext \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
98 changes: 51 additions & 47 deletions rest/management-api-v2/cm_api_v2_post_legacy_webhook.curl
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,56 @@ curl --request POST \
--header 'Content-type: application/json' \
--data '
{
"name": "Example",
"url": "https://example.com",
"secret": "secret",
"triggers": {
"delivery_api_content_changes": [
{
"type": "content_item_variant",
"operations": [
"publish",
"unpublish"
]
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
}
],
"preview_delivery_api_content_changes": [
{
"type": "content_item_variant",
"operations": [
"archive",
"upsert"
]
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
}
],
"workflow_step_changes": [
{
"type": "content_item_variant",
"transitions_to": [
{ "id": "b4363ccd-8f21-45fd-a840-5843d7b7f008" },
{ "id": "88ac5e6e-1c5c-4638-96e1-0d61221ad5bf" }
]
}
"name": "Example",
"url": "https://example.com",
"secret": "secret",
"triggers": {
"delivery_api_content_changes": [
{
"type": "content_item_variant",
"operations": [
"publish",
"unpublish"
]
}
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
}
],
"preview_delivery_api_content_changes": [
{
"type": "content_item_variant",
"operations": [
"archive",
"upsert"
]
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
}
],
"workflow_step_changes": [
{
"type": "content_item_variant",
"transitions_to": [
{
"id": "b4363ccd-8f21-45fd-a840-5843d7b7f008"
},
{
"id": "88ac5e6e-1c5c-4638-96e1-0d61221ad5bf"
}
]
}
]
}
}'
119 changes: 78 additions & 41 deletions rest/management-api-v2/cm_api_v2_post_webhook.curl
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,89 @@ curl --request POST \
--header 'Content-type: application/json' \
--data '
{
"name": "Example",
"url": "https://example.com",
"secret": "secret",
"triggers": {
"delivery_api_content_changes": [
"name": "Example webhook",
"url": "https://example.com/webhook",
"enabled": "true",
"delivery_triggers": {
"slot": "preview",
"events": "specific",
"content_type": {
"enabled": "true",
"actions": [
{
"action": "changed"
}
]
},
"asset": {
"enabled": "true",
"actions": [
{
"action": "deleted"
}
]
},
"taxonomy": {
"enabled": "true",
"actions": [
{
"action": "term_changed"
}
]
},
"language": {
"enabled": "true",
"actions": [
{
"action": "changed"
},
{
"action": "created"
}
]
},
"content_item": {
"enabled": "true",
"actions": [
{
"action": "workflow_step_changed",
"transition_to": [
{
"type": "content_item_variant",
"operations": [
"publish",
"unpublish"
]
"workflow_identifier": {
"id": "131a952b-ead3-448f-84f4-644d5fea49b1"
},
"step_identifier": {
"id": "b4363ccd-8f21-45fd-a840-5843d7b7f008"
}
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
"workflow_identifier": {
"id": "ee4aa121-fcdf-417e-bcc2-929a94a83727"
},
"step_identifier": {
"id": "88ac5e6e-1c5c-4638-96e1-0d61221ad5bf"
}
}
]
}
],
"filters": {
"collections": [
{
"id": "a1b6c97b-0af1-4791-bdc8-b5d0556004ae"
}
],
"preview_delivery_api_content_changes": [
{
"type": "content_item_variant",
"operations": [
"archive",
"upsert"
]
},
{
"type": "taxonomy",
"operations": [
"archive",
"restore",
"upsert"
]
}
"content_types": [
{
"id": "99efc78f-af77-4535-a553-3ae2c5fd5385"
}
],
"workflow_step_changes": [
{
"type": "content_item_variant",
"transitions_to": [
{ "id": "b4363ccd-8f21-45fd-a840-5843d7b7f008" },
{ "id": "88ac5e6e-1c5c-4638-96e1-0d61221ad5bf" }
]
}
"languages": [
{
"id": "16ec3fdb-cb3d-42ea-a179-6fd682d4a25b"
}
]
}
}
}'
}
}'
2 changes: 1 addition & 1 deletion rest/management-api-v2/mapi_v2_disable_legacy_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks/5df74e27-1213-484e-b9ae-bcbe90bd5990/disable \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/mapi_v2_disable_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks-vnext/5df74e27-1213-484e-b9ae-bcbe90bd5990/disable \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/mapi_v2_enable_legacy_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks/5df74e27-1213-484e-b9ae-bcbe90bd5990/enable \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'
2 changes: 1 addition & 1 deletion rest/management-api-v2/mapi_v2_enable_webhook.curl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/webhooks-vnext/5df74e27-1213-484e-b9ae-bcbe90bd5990/enable \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json'
--header 'Content-type: application/json'

0 comments on commit 85baf0c

Please sign in to comment.