Skip to content

Commit c32c58c

Browse files
Merge pull request mendix#5962 from mendix/lz-webhook-api
Webhooks API
2 parents 2d9109b + 56ea750 commit c32c58c

4 files changed

Lines changed: 739 additions & 1 deletion

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: "Webhooks API"
3+
url: /apidocs-mxsdk/apidocs/webhooks-api/
4+
type: swagger
5+
category: "API Documentation"
6+
weight: 97
7+
tags: ["API", "webhooks", "Mendix Cloud"]
8+
---
9+
10+
{{% alert color="warning" %}} This feature is in Beta. For more information on Beta products, see [Beta Releases](/releasenotes/beta-features/). {{% /alert %}}
11+
12+
## 1 Introduction
13+
14+
The Mendix Webhooks API allows you to manage [webhooks](/developerportal/deploy/webhooks/).
15+
16+
You can use the API to do the following:
17+
18+
* List all webhooks
19+
* Get a webhook
20+
* Create a webhook
21+
* Update a webhook
22+
* Delete a webhook
23+
24+
## 2 Authentication{#authentication}
25+
26+
Authentication for the Webhooks API uses a personal access token (PAT).
27+
28+
### 2.1 Generating a PAT
29+
30+
To generate a PAT, see the [Personal Access Tokens](/developerportal/community-tools/mendix-profile/#pat) section in *Mendix Profile*.
31+
32+
Select the following as scopes:
33+
34+
* `mx:webhook:read` – to perform `GET` operations
35+
* `mx:webhook:write` – to perform all operations (`GET`, `POST`, `PUT`, and `DELETE`)
36+
37+
Store the generated value `{GENERATED_PAT}` somewhere safe so you can use it to authorize your Mendix Cloud Webhooks API calls.
38+
39+
### 2.2 Using the PAT
40+
41+
Each request must contain an `Authorization` header with the value `MxToken {GENERATED_PAT}`. For example:
42+
43+
```http {linenos=false}
44+
GET /apps/80a28d6e-c5fc-43d9-87c2-d7d56b07542/webhooks HTTP/1.1
45+
Authorization: MxToken 7LJE…vk
46+
```
47+
48+
To authenticate calls when using the Open API specification below, click **Authorize** and use the value `MxToken {GENERATED_PAT}`.
49+
50+
## 3 Examples
51+
52+
### 3.1 Using the API to Create and Update a Webhook Endpoint
53+
54+
The following procedure will create a webhook endpoint and update the webhook endpoint:
55+
56+
1. Set up your authentication PAT.
57+
58+
2. To create a wehhook for an app, call `POST /apps/{app-id}/webhooks`. For example:
59+
60+
```http {linenos=false}
61+
POST /apps/80a28d6e-c5fc-43d9-87c2-d7d56b07542e/webhooks
62+
```
63+
64+
The API call returns `id`, `name`, `url`, `eventTypes`, `isActive`, `validationSecret` and `headers` of the new webhook, together with status code `200`.
65+
66+
3. To update the new webhook, call `PUT /apps/{app-id}/webhooks/{webhook-id}`, with a request body. For example:
67+
68+
* API call:
69+
70+
```http {linenos=false}
71+
PUT /apps/80a28d6e-c5fc-43d9-87c2-d7d56b07542e/webhooks/msg_2M605iBQRge9hTgpYg7fKXQubaw
72+
```
73+
* Request body:
74+
75+
```json
76+
{
77+
"name": "string",
78+
"url": "https://some.domain.com/webhooks",
79+
"eventTypes": [
80+
"teamserver.push"
81+
],
82+
"isActive": true,
83+
"validationSecret": "PMJhiGo1nTL6wlNyZVFh5v9rLZdcLsG2O",
84+
"headers": [
85+
{
86+
"key": "Authorization",
87+
"value": "Beaerer DG4R4GT6R43"
88+
}
89+
]
90+
}
91+
```
92+
93+
If the update succeeds, you should receive status code `202`. You can get the updated webhook details by calling `GET apps/{app-id}/webhooks/{webhook-id}`.
94+
95+
96+
## 4 API Reference
97+
98+
{{< swaggerui src="/openapi-spec/webhooks.yaml" >}}

content/en/docs/apidocs-mxsdk/apidocs/webhooks-sprints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ linktitle: "Webhooks for Stories/Sprints"
44
url: /apidocs-mxsdk/apidocs/webhooks-sprints/
55
category: "API Documentation"
66
description: "These webhooks allow you to build or set up Mendix Platform connectors that subscribe to certain events on the Developer Portal."
7-
weight: 97
7+
weight: 100
88
---
99

1010
## 1 Introduction

content/en/docs/releasenotes/developer-portal/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ To see the current status of the Mendix Developer Portal and Control Center, see
1717

1818
## 2023
1919

20+
### June 15th, 2023
21+
22+
#### New Features
23+
24+
* We have released [Webhooks API](/apidocs-mxsdk/apidocs/webhooks-api/) for Beta usage.
25+
2026
### June 1st, 2023
2127

2228
#### Improvements

0 commit comments

Comments
 (0)