1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-22 02:32:51 +01:00

Added JSON schema

kaotik4266 2017-07-09 16:28:00 +10:00
parent 7758442c6a
commit f86f9c740d

98
Webhook-Schema.md Normal file

@ -0,0 +1,98 @@
### Overview ###
This page provides a [JSON schema](http://json-schema.org/) for validating events received from Sonarr's [Webhook](https://github.com/Sonarr/Sonarr/wiki/Webhook).
### Schema ###
```json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "SonarrEvent",
"description": "Sonarr Webhook Event",
"type": "object",
"anyOf": [
{
"properties": {
"eventType": { "enum": ["Grab"] }
},
"required": ["eventType", "series", "episodes", "release"]
},
{
"properties": {
"eventType": { "enum": ["Download"] }
},
"required": ["eventType", "series", "episodes", "episodeFile", "isUpgrade"]
},
{
"properties": {
"eventType": { "enum": ["Rename"] }
},
"required": ["eventType", "series"]
},
{
"properties": {
"eventType": { "enum": ["Test"] }
},
"required": ["eventType", "series", "episodes"]
}
],
"properties":{
"eventType": { "enum": ["Download", "Grab", "Rename", "Test"] },
"series": {
"type": "object",
"required": ["id", "title", "path"],
"properties": {
"id": { "type": "integer", "minimum": 0 },
"title": { "type": "string" },
"path": { "type": "string" },
"tvdbId": { "type": "integer", "minimum": 0 }
}
},
"episodes": {
"type": ["array", "null"],
"minItems": 1,
"items": {
"type": "object",
"required": ["id", "episodeNumber", "seasonNumber", "title"],
"properties": {
"id": { "type": "integer", "minimum": 0 },
"episodeNumber": { "type": "integer", "minimum": 0 },
"seasonNumber": { "type": "integer", "minimum": 0 },
"title": { "type": "string" },
"airDate": { "type": "string", "format": "date" },
"airDateUtc": { "type": "string", "format": "date-time" },
"quality": { "type": "string" },
"qualityVersion": { "type": "integer", "minimum": 0 },
"releaseGroup": { "type": "string" },
"sceneName": { "type": "string" }
}
}
},
"release": {
"type": "object",
"properties": {
"quality": { "type": "string"},
"qualityVersion": { "type": "integer", "minimum": 0 },
"releaseGroup": { "type": "string" },
"releaseTitle": { "type": "string" },
"indexer": { "type": "string" },
"size": { "type": "integer", "minimum": 0}
}
},
"episodeFile": {
"type": "object",
"required": ["id", "relativePath", "path"],
"properties": {
"id": { "type": "integer", "minimum": 0 },
"relativePath": { "type": "string" },
"path": { "type": "string" },
"quality": { "type": "string" },
"qualityVersion": { "type": "integer", "minimum": 0 },
"releaseGroup": { "type": "string" },
"sceneName": { "type": "string" }
}
},
"isUpgrade": { "type": "boolean" }
}
}
```