service-hooks.json 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. "$ref": "../../components/parameters/pagination-cursor.json#/PaginationCursor"
  27. }
  28. ],
  29. "responses": {
  30. "200": {
  31. "description": "Success",
  32. "content": {
  33. "application/json": {
  34. "schema": {
  35. "type": "array",
  36. "items": {
  37. "$ref": "../../components/schemas/service-hook.json#/ServiceHook"
  38. }
  39. },
  40. "example": [
  41. {
  42. "dateCreated": "2018-11-06T21:20:08.143Z",
  43. "events": ["event.alert", "event.created"],
  44. "id": "4f9d73e63b7144ecb8944c41620a090b",
  45. "secret": "8fcac28aaa4c4f5fa572b61d40a8e084364db25fd37449c299e5a41c0504cbc2",
  46. "status": "active",
  47. "url": "https://empowerplant.io/sentry-hook"
  48. }
  49. ]
  50. }
  51. }
  52. },
  53. "403": {
  54. "description": "You do not have that feature enabled"
  55. }
  56. },
  57. "security": [
  58. {
  59. "auth_token": ["project:read"]
  60. }
  61. ]
  62. },
  63. "post": {
  64. "tags": ["Projects"],
  65. "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.",
  66. "operationId": "Register a New Service Hook",
  67. "parameters": [
  68. {
  69. "name": "organization_slug",
  70. "in": "path",
  71. "description": "The slug of the organization the client keys belong to.",
  72. "required": true,
  73. "schema": {
  74. "type": "string"
  75. }
  76. },
  77. {
  78. "name": "project_slug",
  79. "in": "path",
  80. "description": "The slug of the project the client keys belong to.",
  81. "required": true,
  82. "schema": {
  83. "type": "string"
  84. }
  85. }
  86. ],
  87. "requestBody": {
  88. "content": {
  89. "application/json": {
  90. "schema": {
  91. "required": ["url", "events"],
  92. "type": "object",
  93. "properties": {
  94. "url": {
  95. "type": "string",
  96. "description": "The URL for the webhook."
  97. },
  98. "events": {
  99. "type": "array",
  100. "description": "The events to subscribe to.",
  101. "items": {
  102. "type": "string"
  103. }
  104. }
  105. }
  106. },
  107. "example": {
  108. "url": "https://empowerplant.io/sentry-hook",
  109. "events": ["event.alert", "event.created"]
  110. }
  111. }
  112. },
  113. "required": true
  114. },
  115. "responses": {
  116. "201": {
  117. "description": "Success",
  118. "content": {
  119. "application/json": {
  120. "schema": {
  121. "$ref": "../../components/schemas/service-hook.json#/ServiceHook"
  122. },
  123. "example": {
  124. "dateCreated": "2018-11-06T21:20:08.143Z",
  125. "events": ["event.alert", "event.created"],
  126. "id": "4f9d73e63b7144ecb8944c41620a090b",
  127. "secret": "8fcac28aaa4c4f5fa572b61d40a8e084364db25fd37449c299e5a41c0504cbc2",
  128. "status": "active",
  129. "url": "https://empowerplant.io/sentry-hook"
  130. }
  131. }
  132. }
  133. },
  134. "403": {
  135. "description": "You do not have that feature enabled"
  136. },
  137. "404": {
  138. "description": "The requested resource does not exist"
  139. }
  140. },
  141. "security": [
  142. {
  143. "auth_token": ["project:write"]
  144. }
  145. ]
  146. }
  147. }