mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-12 08:34:43 +00:00
Add multipart form data examples
This commit is contained in:
parent
5b4e60e7d7
commit
8702b37430
1 changed files with 70 additions and 4 deletions
|
@ -287,12 +287,12 @@ __Not recommended in production due to low security__
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
# JIRA Webhooks
|
## JIRA Webhooks
|
||||||
[Guide by @perfecto25](https://sites.google.com/site/mrxpalmeiras/notes/jira-webhooks)
|
[Guide by @perfecto25](https://sites.google.com/site/mrxpalmeiras/notes/jira-webhooks)
|
||||||
|
|
||||||
# Pass File-to-command sample
|
## Pass File-to-command sample
|
||||||
|
|
||||||
## Webhook configuration
|
### Webhook configuration
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
[
|
[
|
||||||
|
@ -315,7 +315,7 @@ __Not recommended in production due to low security__
|
||||||
]
|
]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
## Sample client usage
|
### Sample client usage
|
||||||
|
|
||||||
Store the following file as `testRequest.json`.
|
Store the following file as `testRequest.json`.
|
||||||
|
|
||||||
|
@ -474,3 +474,69 @@ Given the following payload:
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Multipart Form Data
|
||||||
|
|
||||||
|
Example of a [Plex Media Server webhook](https://support.plex.tv/articles/115002267687-webhooks/).
|
||||||
|
The Plex Media Server will send two parts: payload and thumb.
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "plex",
|
||||||
|
"execute-command": "play-command.sh",
|
||||||
|
"trigger-rule":
|
||||||
|
{
|
||||||
|
"match":
|
||||||
|
{
|
||||||
|
"type": "value",
|
||||||
|
"parameter": {
|
||||||
|
"source": "payload"
|
||||||
|
"name": "payload.event",
|
||||||
|
},
|
||||||
|
"value": "media.play"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Each part of a multipart form data body will have a `Content-Disposition` header.
|
||||||
|
An example header:
|
||||||
|
|
||||||
|
```
|
||||||
|
Content-Disposition: form-data; name="payload"; filename="payload.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
We key off of the `name` attribute in the `Content-Disposition` value.
|
||||||
|
|
||||||
|
If the named part is JSON but has an incorrect `Content-Type`,
|
||||||
|
use the `parse-parameters-as-json` setting to force it to be parsed as JSON:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "plex",
|
||||||
|
"execute-command": "play-command.sh",
|
||||||
|
"parse-parameters-as-json": [
|
||||||
|
{
|
||||||
|
"source": "payload",
|
||||||
|
"name": "payload"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"trigger-rule":
|
||||||
|
{
|
||||||
|
"match":
|
||||||
|
{
|
||||||
|
"type": "value",
|
||||||
|
"parameter": {
|
||||||
|
"source": "payload"
|
||||||
|
"name": "payload.event",
|
||||||
|
},
|
||||||
|
"value": "media.play"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue