{"openapi":"3.1.0","info":{"title":"Error Notification Service","description":"API consuming Azure ServiceBus messages and publishing error messages to the scan supplier","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"version":"1"},"servers":[{"url":"http://localhost","description":"Generated server url"}],"tags":[{"name":"Information on notifications","description":"Endpoint for notifications present for this service"}],"paths":{"/notifications":{"get":{"tags":["Information on notifications"],"summary":"Get list of error notifications","description":"Get list of error notifications for specific date","operationId":"getNotifications","parameters":[{"name":"file_name","in":"query","description":"File name to look up","required":true,"schema":{"type":"string"},"example":"2000000000000_24-06-2020-12-28-19.example.zip"},{"name":"ServiceAuthorization","in":"header","required":false,"schema":{"type":"string"}},{"name":"zip_file_name","in":"query","description":"File name to look-up notifications","required":true,"schema":{"type":"string"},"example":"2022304020414_17-08-2020-11-19-12.zip"},{"name":"date","in":"query","description":"Date boundary to look-up notifications in","required":true,"schema":{"type":"string","format":"date"},"example":"2020-06-24"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}},"401":{"description":"Unauthenticated / Invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}},"500":{"description":"Error getting data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}}}},"post":{"tags":["Information on notifications"],"summary":"Add a new notification","operationId":"addNotification","parameters":[{"name":"ServiceAuthorization","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotifyRequest"}}},"required":true},"responses":{"201":{"description":"Successfully created notification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}},"401":{"description":"Unauthorised user/Invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}},"400":{"description":"If the notify request body does not pass validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}},"424":{"description":"If there is an error notifying the supplier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}}}}},"/notifications/{notificationId}":{"get":{"tags":["Information on notifications"],"summary":"Get a Notification by its ID","operationId":"getNotificationByNotificationId","parameters":[{"name":"notificationId","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful - Notification Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}},"404":{"description":"Notification Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}},"400":{"description":"Given ID is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInfo"}}}}}}},"/notifications/all-pending":{"get":{"tags":["Information on notifications"],"summary":"Get list of error notifications","description":"Get list of all pending notifications","operationId":"getAllPendingNotifications","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}},"401":{"description":"Unauthenticated / Invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}},"500":{"description":"Error validating service header","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}}}}},"/feature-flags/{flag}":{"get":{"tags":["feature-flag-controller"],"operationId":"flagStatus","parameters":[{"name":"flag","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"NotifyRequest":{"type":"object","properties":{"zip_file_name":{"type":"string","minLength":1},"jurisdiction":{"type":"string"},"po_box":{"type":"string"},"container":{"type":"string","minLength":1},"document_control_number":{"type":"string"},"error_code":{"type":"string","enum":["ERR_FILE_LIMIT_EXCEEDED","ERR_METAFILE_INVALID","ERR_PAYMENTS_DISABLED","ERR_SERVICE_DISABLED","ERR_AV_FAILED","ERR_SIG_VERIFY_FAILED","ERR_RESCAN_REQUIRED","ERR_ZIP_PROCESSING_FAILED"]},"error_description":{"type":"string","minLength":1},"service":{"type":"string","minLength":1}},"required":["container","error_code","error_description","service","zip_file_name"]},"NotificationInfo":{"type":"object","properties":{"id":{"type":"string","description":"Autogenerated DB ID","title":"Notification internal ID"},"confirmation_id":{"type":"string","description":"ID received from third party","title":"Notification external ID"},"zip_file_name":{"type":"string","title":"Zip file name"},"po_box":{"type":"string","title":"PO box"},"container":{"type":"string","description":"Container origin of zip_file_name","title":"Origin of zip_file_name"},"service":{"type":"string","title":"File name representing service"},"document_control_number":{"type":"string","description":"Related DNC number (if applicable)","title":"Related DCN number"},"error_code":{"type":"string","description":"Agreed error code","title":"Error code"},"error_description":{"type":"string","description":"Error description","title":"Error description"},"created_at":{"type":"string","format":"date-time","description":"Time when notification was created","title":"Created at"},"processed_at":{"type":"string","format":"date-time","description":"Time when notification was persisted to third party","title":"Processed at"},"status":{"type":"string","description":"Current end state of the notification","title":"End state"}}},"NotificationsResponse":{"type":"object","properties":{"count":{"type":"integer","format":"int32","description":"Number of notifications found","title":"Notification count"},"pendingNotificationsCount":{"type":"integer","format":"int32","description":"Number of notifications with 'Pending' status","title":"Pending Notifications count"},"sentNotificationsCount":{"type":"integer","format":"int32","description":"Number of notifications with 'Sent' status","title":"Sent Notification count"},"notifications":{"type":"array","description":"Full list of notifications found","items":{"$ref":"#/components/schemas/NotificationInfo"},"title":"List of notifications"}}}}}}
