{"openapi":"3.1.0","info":{"description":"A generic Scheduler application to trigger jobs at set intervals","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"title":"Scheduler Specifications","version":"v0.0.1"},"servers":[{"url":"http://localhost","description":"Generated server url"}],"paths":{"/job/{job-key}":{"delete":{"description":"This will delete the Job from the System as well as any associated Tasks","operationId":"deleteJob","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"200":{"description":"Job Deleted"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Delete Job","tags":["Job"]},"get":{"description":"Returns the details of the selected Job","operationId":"getJobDetails","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDetails"}}},"description":"Found"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Get Job Details","tags":["Job"]},"patch":{"description":"Will update the specified Job with the details you provide (any details you do not provide will remain unchanged)","operationId":"updateJob","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIJobPatch"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDetails"}}},"description":"Job updated successfully."},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InvalidPayloadError"}}},"description":"Invalid Payload"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/IncorrectPayloadForJobTypeError"}}},"description":"Business Validation Rule"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Updates Job Data","tags":["Job"]}},"/job/{job-key}/disable":{"put":{"description":"Disables the specified Job, allowing it to be automatically executed at time intervals specified in the Jobs Cron Expression. (This is only valid for Scheduled Jobs. I.e ones with a Cron expression)","operationId":"disableJob","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"202":{"description":"Job Disabled"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"422":{"content":{"application/problem+json":{"schema":{"type":"string","anyOf":[{"$ref":"#/components/schemas/NotAScheduledJobError"},{"$ref":"#/components/schemas/JobAlreadyDisabledError"}]}}},"description":"Business Validation Rule"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Disable Job","tags":["Job"]}},"/job/{job-key}/enable":{"put":{"description":"Enables the specified Job, allowing it to be automatically executed at time intervals specified in the Jobs Cron Expression. (This is only valid for Scheduled Jobs. I.e ones with a Cron expression)","operationId":"enableJob","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"202":{"description":"Job Enabled"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"422":{"content":{"application/problem+json":{"schema":{"type":"string","anyOf":[{"$ref":"#/components/schemas/NotAScheduledJobError"},{"$ref":"#/components/schemas/JobAlreadyEnabledError"}]}}},"description":"Business Validation Rule"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Enable Job","tags":["Job"]}},"/job/{job-key}/run":{"put":{"description":"Trigger the Job to run immediately (Bypassing any schedules if set, as well as enabled/disabled state).","operationId":"runJob","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"202":{"description":"Job queued to run."},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Run Job","tags":["Job"]}},"/job/{job-key}/status":{"get":{"description":"Returns the latest task for a Job","operationId":"getJobStatus","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskDetail"}}},"description":"TaskEntity details found for this Job"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Get the latest task for a Job","tags":["Job"]}},"/job/{job-key}/task/{task-id}":{"get":{"description":"Returns the details of the selected TaskEntity","operationId":"getTaskDetail","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}},{"in":"path","name":"task-id","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":1}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskDetail"}}},"description":"Returns the task details"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Returns task details","tags":["TaskEntity"]}},"/job/{job-key}/task/{task-id}/status":{"put":{"description":"This API will update the task status after execution. This is designed to allow third party systems to inform the scheduler that an asynchronous task has successfully or unsuccessfully executed.","operationId":"updateTaskStatus","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}},{"in":"path","name":"task-id","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":1}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusUpdate"}}},"required":true},"responses":{"202":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskDetail"}}},"description":"Successfully updated TaskEntity status"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Update TaskEntity Status","tags":["TaskEntity"]}},"/job/{job-key}/tasks":{"get":{"description":"Returns the tasks for a Job","operationId":"getJobTasks","parameters":[{"in":"path","name":"job-key","required":true,"schema":{"type":"string","pattern":"[A-Z_0-9]{3,50}"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaskDetail"}}}},"description":"TaskEntity details found for this Job"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Get all the tasks for a Job","tags":["Job"]}},"/jobs/api":{"post":{"description":"An API Job will send an API call to a third party and validate its response when triggered. This API allows you to create a new API Job.","operationId":"createAPIJob","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIJobDetails"}}},"required":true},"responses":{"201":{"description":"Created"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InvalidPayloadError"}}},"description":"Invalid Payload"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/KeyAlreadyInUseError"}}},"description":"Key already in use"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Create a new API Job","tags":["Jobs"]}},"/jobs/search":{"get":{"description":"Returns the details of the found tasks","operationId":"getJobs","parameters":[{"description":"The job to search for on. (If none provided all Jobs will be searched)","in":"query","name":"job_key","required":false,"schema":{"type":"string","description":"The job to search for on. (If none provided all Jobs will be searched)","pattern":"[A-Z_0-9]{3,50}"}},{"description":"The tags to filter by","in":"query","name":"tag","required":false,"schema":{"$ref":"#/components/schemas/tag"}},{"description":"The enabled status to filter on","in":"query","name":"enabled","required":false,"schema":{"type":"boolean","description":"The enabled status to filter on"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaskDetail"}}}},"description":"List of Tasks."},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InvalidPayloadError"}}},"description":"Invalid Parameters"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Searches for a list of tasks","tags":["Jobs"]}},"/tasks/search":{"get":{"description":"Returns the details of the found tasks","operationId":"getTasks","parameters":[{"description":"The date at which we should return any failures from.","in":"query","name":"from_date","required":false,"schema":{"type":"string","format":"date-time","default":"Today's date minus 7 days","description":"The date at which we should return any failures from."}},{"description":"The job to search for. (If none provided all Jobs will be searched)","in":"query","name":"job_key","required":false,"schema":{"type":"string","description":"The job to search for. (If none provided all Jobs will be searched)","pattern":"[A-Z_0-9]{3,50}"}},{"description":"The statuses to filter by","in":"query","name":"status","required":false,"schema":{"$ref":"#/components/schemas/status"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaskDetail"}}}},"description":"List of Tasks."},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InvalidPayloadError"}}},"description":"Invalid Parameters"},"401":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorisedError"}}},"description":"Unauthorised"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/NotFoundError"}}},"description":"Not Found"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}},"description":"Internal Server Error"}},"summary":"Searches for a list of tasks","tags":["Tasks"]}}},"components":{"schemas":{"APIJobDetails":{"type":"object","properties":{"authentication_default":{"type":"string","description":"If present an authentication token will automatically be added to your API request based on the selected system.","enum":["NONE","JUROR_API_SERVICE","API_JOB_EXECUTION_SERVICE"]},"cron_expression":{"type":"string","description":"The cron expression that should be used to schedule this Job. If none is provided the Job will be unscheduled as such will only run if manually triggered."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"All the headers that should be included when making the API Request"},"information":{"$ref":"#/components/schemas/Information","description":"This section stores information about the job"},"key":{"type":"string","description":"The key is the unique identifier that should be assigned to this Job.","pattern":"[A-Z_0-9]{3,50}"},"method":{"type":"string","description":"The method to use when making the API request","enum":["POST","GET","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]},"payload":{"type":"string","description":"The payload to include along with the request (Note this should not be present for GET requests)"},"post_execution_actions":{"type":"array","items":{"$ref":"#/components/schemas/Action"}},"type":{"type":"string","enum":["API"]},"url":{"type":"string","description":"The fully quantified url to call when making the API request"},"validations":{"type":"array","description":"A list of validations that should be applied to the response after the API request has been made. If any of these fail the task will fail.","items":{"$ref":"#/components/schemas/APIValidation"},"maxItems":250,"minItems":1}},"required":["information","key","method","type","url","validations"]},"APIJobPatch":{"type":"object","minProperties":1,"properties":{"authentication_default":{"type":"string","description":"If present an authentication token will automatically be added to your API request based on the selected system.","enum":["NONE","JUROR_API_SERVICE","API_JOB_EXECUTION_SERVICE"]},"cron_expression":{"type":"string","description":"This is the cron expression that will be used to setup automated triggering of this Job"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"All the headers that should be included when making the API Request"},"information":{"$ref":"#/components/schemas/Information","description":"The information about the Job"},"method":{"type":"string","description":"The method to use when making the API request","enum":["POST","GET","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]},"payload":{"type":"string","description":"The payload to include along with the request (Note this should not be present for GET requests)"},"post_execution_actions":{"type":"array","items":{"$ref":"#/components/schemas/Action"}},"url":{"type":"string","description":"The fully quantified url to call when making the API request"},"validations":{"type":"array","items":{"$ref":"#/components/schemas/APIValidation"},"maxItems":250,"minItems":1}}},"APIValidation":{"discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/JsonPathAPIValidation"},{"$ref":"#/components/schemas/StatusCodeAPIValidation"},{"$ref":"#/components/schemas/MaxResponseTimeAPIValidation"}],"properties":{"type":{"type":"string"}},"required":["type"]},"Action":{"type":"object","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/RunJobAction"}],"properties":{"condition":{"type":"string","enum":["ON_PENDING","ON_VALIDATION_PASSED","ON_VALIDATION_FAILED","ON_PROGRESSING","ON_FAILED_UNEXPECTED_EXCEPTION","ON_SUCCESS","ON_PARTIAL_SUCCESS","ON_FAILED","ON_INDETERMINATE"]},"type":{"type":"string"}},"required":["type"]},"IncorrectPayloadForJobTypeError":{"type":"object","properties":{"code":{"type":"string","enum":["INCORRECT_PAYLOAD_FOR_JOB_TYPE"]},"messages":{"type":"array","enum":["The payload you have entered is not valid for this type of Job."],"items":{"type":"string"}}},"required":["code","messages"]},"Information":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string","minLength":1},"uniqueItems":true}},"required":["name"]},"InternalServerError":{"type":"object","properties":{"code":{"type":"string","enum":["INTERNAL_SERVER_ERROR"]},"messages":{"type":"array","enum":["An internal server error has occurred. Please contact system administrators if this problem persists."],"items":{"type":"string"}}},"required":["code","messages"]},"InvalidPayloadError":{"type":"object","properties":{"code":{"type":"string","enum":["INVALID_PAYLOAD"]},"messages":{"type":"array","items":{"type":"string"}}},"required":["code","messages"]},"JobAlreadyDisabledError":{"type":"object","properties":{"code":{"type":"string","enum":["JOB_ALREADY_DISABLED"]},"messages":{"type":"array","enum":["This Job is already disabled"],"items":{"type":"string"}}},"required":["code","messages"]},"JobAlreadyEnabledError":{"type":"object","properties":{"code":{"type":"string","enum":["JOB_ALREADY_ENABLED"]},"messages":{"type":"array","enum":["This Job is already enabled"],"items":{"type":"string"}}},"required":["code","messages"]},"JobDetails":{"type":"object","oneOf":[{"$ref":"#/components/schemas/APIJobDetails"}],"properties":{"cron_expression":{"type":"string","description":"The cron expression that should be used to schedule this Job. If none is provided the Job will be unscheduled as such will only run if manually triggered."},"information":{"$ref":"#/components/schemas/Information","description":"This section stores information about the job"},"key":{"type":"string","description":"The key is the unique identifier that should be assigned to this Job.","pattern":"[A-Z_0-9]{3,50}"},"post_execution_actions":{"type":"array","items":{"$ref":"#/components/schemas/Action"}},"type":{"type":"string","description":"This is the type of Job the details is representing","enum":["API"]}},"required":["information","key","type"]},"JsonPathAPIValidation":{"allOf":[{"$ref":"#/components/schemas/APIValidation"},{"type":"object","properties":{"expected_response":{"type":"string","description":"This is the expected value that the JsonPath should return when evaluated against the API response"},"path":{"type":"string","description":"This is the JSON path that the response payload will be evaluated against."}}}],"required":["expected_response","path"]},"KeyAlreadyInUseError":{"type":"object","properties":{"code":{"type":"string","enum":["KEY_ALREADY_IN_USE"]},"messages":{"type":"array","enum":["The key you have provided is already in use. Please choice a unique key."],"items":{"type":"string"}}},"required":["code","messages"]},"MaxResponseTimeAPIValidation":{"allOf":[{"$ref":"#/components/schemas/APIValidation"},{"type":"object","properties":{"max_response_time_ms":{"type":"integer","format":"int32","description":"This is the maximum response time that is allowed before the TaskEntity will fail.","maximum":30000,"minimum":1}}}],"required":["max_response_time_ms"]},"NotAScheduledJobError":{"type":"object","properties":{"code":{"type":"string","enum":["NOT_A_SCHEDULED_JOB"]},"messages":{"type":"array","enum":["The action you are trying to perform is only valid on Scheduled Jobs."],"items":{"type":"string"}}},"required":["code","messages"]},"NotFoundError":{"type":"object","properties":{"code":{"type":"string","enum":["NOT_FOUND"]},"messages":{"type":"array","enum":["The requested resource could not be located."],"items":{"type":"string"}}},"required":["code","messages"]},"RunJobAction":{"allOf":[{"$ref":"#/components/schemas/Action"},{"type":"object","properties":{"job_key":{"type":"string","minLength":1}}}],"required":["job_key"]},"StatusCodeAPIValidation":{"allOf":[{"$ref":"#/components/schemas/APIValidation"},{"type":"object","properties":{"expected_status_code":{"type":"integer","format":"int32","description":"The expected status code from the API request. Job will fail if something other than this is returned.","maximum":599,"minimum":100}}}],"required":["expected_status_code"]},"StatusUpdate":{"type":"object","properties":{"message":{"type":"string","description":"A brief message that can be displayed back to the user to help explain the status change"},"meta_data":{"type":"object","additionalProperties":{"type":"string"},"description":"A map of data relating to the task"},"status":{"type":"string","description":"The new status of the task","enum":["PENDING","PROCESSING","VALIDATION_PASSED","VALIDATION_FAILED","PROGRESSING","FAILED_UNEXPECTED_EXCEPTION","SUCCESS","FAILED","INDETERMINATE","PARTIAL_SUCCESS"]}},"required":["status"]},"TaskDetail":{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"},"job_key":{"type":"string","description":"The Job this task relates too","pattern":"[A-Z_0-9]{3,50}"},"last_updated_at":{"type":"string","format":"date-time"},"message":{"type":"string","description":"A message received from the Job"},"meta_data":{"type":"object","additionalProperties":{},"description":"A map of data relating to the task"},"post_actions_message":{"type":"string","description":"Messages received from post actions (always null if Job has no post actions)"},"status":{"type":"string","description":"The execution status of the Task","enum":["PENDING","PROCESSING","VALIDATION_PASSED","VALIDATION_FAILED","PROGRESSING","FAILED_UNEXPECTED_EXCEPTION","SUCCESS","FAILED","INDETERMINATE","PARTIAL_SUCCESS"]},"task_id":{"type":"integer","format":"int32","maximum":9223372036854775807,"minimum":1}},"required":["created_at","job_key","status","task_id"]},"UnauthorisedError":{"type":"object","properties":{"code":{"type":"string","enum":["UNAUTHORISED"]},"messages":{"type":"array","enum":["You are not authorised"],"items":{"type":"string"}}},"required":["code","messages"]},"status":{"type":"array","description":"The statuses to filter by","items":{"type":"string","description":"The statuses to filter by","enum":["PENDING","PROCESSING","VALIDATION_PASSED","VALIDATION_FAILED","PROGRESSING","FAILED_UNEXPECTED_EXCEPTION","SUCCESS","FAILED","INDETERMINATE","PARTIAL_SUCCESS"]},"uniqueItems":true},"tag":{"type":"array","description":"The tags to filter by","items":{"type":"string","description":"The tags to filter by"},"uniqueItems":true}}}}
