service-hooks.json 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. "get": {
  3. "tags": ["Projects"],
  4. "description": "Return a list of service hooks bound to a project.",
  5. "operationId": "List a project's service hooks",
  6. "parameters": [
  7. {
  8. "name": "organization_slug",
  9. "in": "path",
  10. "description": "The slug of the organization the client keys belong to.",
  11. "required": true,
  12. "schema": {
  13. "type": "string"
  14. }
  15. },
  16. {
  17. "name": "project_slug",
  18. "in": "path",
  19. "description": "The slug of the project the client keys belong to.",
  20. "required": true,
  21. "schema": {
  22. "type": "string"
  23. }
  24. }
  25. ],
  26. "responses": {
  27. "200": {
  28. "description": "Success.",
  29. "content": {
  30. "application/json": {
  31. "schema": {
  32. "type": "array",
  33. "items": {
  34. "$ref": "../../components/schemas/service-hook.json#/ServiceHook"
  35. }
  36. },
  37. "example": [
  38. {
  39. "dateCreated": "2018-11-06T21:20:08.143Z",
  40. "events": ["event.alert", "event.created"],
  41. "id": "4f9d73e63b7144ecb8944c41620a090b",
  42. "secret": "8fcac28aaa4c4f5fa572b61d40a8e084364db25fd37449c299e5a41c0504cbc2",
  43. "status": "active",
  44. "url": "https://example.com/sentry-hook"
  45. }
  46. ]
  47. }
  48. }
  49. },
  50. "403": {
  51. "description": "You do not have that feature enabled"
  52. }
  53. },
  54. "security": [
  55. {
  56. "auth_token": ["project:read"]
  57. }
  58. ]
  59. },
  60. "post": {
  61. "tags": ["Projects"],
  62. "description": "Register a new service hook on a project.\n\nEvents include:\n\n- event.alert: An alert is generated for an event (via rules).\n- event.created: A new event has been processed.\n\nThis endpoint requires the 'servicehooks' feature to be enabled for your project.",
  63. "operationId": "Register a new service hook",
  64. "parameters": [
  65. {
  66. "name": "organization_slug",
  67. "in": "path",
  68. "description": "The slug of the organization the client keys belong to.",
  69. "required": true,
  70. "schema": {
  71. "type": "string"
  72. }
  73. },
  74. {
  75. "name": "project_slug",
  76. "in": "path",
  77. "description": "The slug of the project the client keys belong to.",
  78. "required": true,
  79. "schema": {
  80. "type": "string"
  81. }
  82. }
  83. ],
  84. "requestBody": {
  85. "content": {
  86. "application/json": {
  87. "schema": {
  88. "required": ["url", "events"],
  89. "type": "object",
  90. "properties": {
  91. "url": {
  92. "type": "string",
  93. "description": "The url for the webhook."
  94. },
  95. "events": {
  96. "type": "array",
  97. "description": "The events to subscribe to.",
  98. "items": {
  99. "type": "string"
  100. }
  101. }
  102. }
  103. },
  104. "example": {
  105. "events": ["event.alert", "event.created"],
  106. "url": "https://example.com/sentry-hook"
  107. }
  108. }
  109. },
  110. "required": true
  111. },
  112. "responses": {
  113. "201": {
  114. "description": "Success.",
  115. "content": {
  116. "application/json": {
  117. "schema": {
  118. "$ref": "../../components/schemas/service-hook.json#/ServiceHook"
  119. },
  120. "example": {
  121. "dateCreated": "2018-11-06T21:20:08.143Z",
  122. "events": ["event.alert", "event.created"],
  123. "id": "4f9d73e63b7144ecb8944c41620a090b",
  124. "secret": "8fcac28aaa4c4f5fa572b61d40a8e084364db25fd37449c299e5a41c0504cbc2",
  125. "status": "active",
  126. "url": "https://example.com/sentry-hook"
  127. }
  128. }
  129. }
  130. },
  131. "403": {
  132. "description": "You do not have that feature enabled"
  133. },
  134. "404": {
  135. "description": "The requested resource does not exist"
  136. }
  137. },
  138. "security": [
  139. {
  140. "auth_token": ["project:write"]
  141. }
  142. ]
  143. }
  144. }