diff --git a/enums/icarBatchResultSeverityType.json b/enums/icarBatchResultSeverityType.json new file mode 100644 index 0000000..c314ae1 --- /dev/null +++ b/enums/icarBatchResultSeverityType.json @@ -0,0 +1,11 @@ +{ + "description": "Severity code to distinguish warnings and errors.", + + "type": "string", + + "enum": [ + "Information", + "Warning", + "Error" + ] + } \ No newline at end of file diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json new file mode 100644 index 0000000..e087e80 --- /dev/null +++ b/resources/icarBatchResult.json @@ -0,0 +1,22 @@ +{ + "description": "Returned by a batch POST event to return identity (meta), errors, and warnings for a resource.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier created in the system for this event. SHOULD be a UUID." + }, + "meta": { + "$ref": "../types/icarMetaDataType.json", + "description": "Metadata for the posted resource. Allows specification of the source, source Id to synchronise data." + }, + "messages": { + "type": "array", + "description": "An arry of errors for this resource.", + "nullable": true, + "items": { + "$ref": "../resources/icarResponseMessageResource.json" + } + } + } +} \ No newline at end of file diff --git a/resources/icarResponseMessageResource.json b/resources/icarResponseMessageResource.json new file mode 100644 index 0000000..8f50b02 --- /dev/null +++ b/resources/icarResponseMessageResource.json @@ -0,0 +1,35 @@ +{ + "description": "An RFC7807 compliant problem response for JSON APIs.", + + "type": "object", + + "properties": { + "type": { + "type": "string", + "description": "Machine readable URI or code that defines the type of error or warning." + }, + "severity": { + "$ref": "../enums/icarBatchResultSeverityType.json", + "description": "Distinguish errors, warnings, and informational messages." + }, + "status": { + "type": "integer", + "description": "The HTTP status code applicable to this problem.", + "format": "int32", + "nullable": true + }, + "title": { + "type": "string", + "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "type": "string", + "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized." + }, + "instance": { + "type": "string", + "description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.", + "nullable": true + } + } +} \ No newline at end of file diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json new file mode 100644 index 0000000..f5f4c47 --- /dev/null +++ b/url-schemes/healthURLScheme.json @@ -0,0 +1,656 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Health Diagnosis and Treatment API Specifications", + "description": "Specifications for messages that support livestock health and disease diagnosis and treatments.", + "version": "1.2", + "contact": { + "name": "Animal Data Exchange Working Group", + "url": "https://www.icar.org/index.php/technical-bodies/working-groups/animal-data-exchange-wg/", + "email": "icar@icar.org" + } + }, + "servers": [ + { + "url": "https://icar-ade.standard.com" + } + ], + "tags": [ + { + "name": "ADE-1.2-health", + "description": "Health messages approved by the working group" + } + ], + "paths": { + "/locations/{location-scheme}/{location-id}/diagnoses": { + "get": { + "operationId": "get-Diagnoses", + "summary": "Get the diagnoses for a certain location", + "description": "# Purpose\nProvides the animal health diagnoses for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the diagnoses for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Diagnosis", + "summary": "Add a single new diagnosis event", + "description": "# Purpose \nAllows a client to add a single animal health diagnosis event.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health diagnosis event to create. \nA client MAY fill in the *Id* field with a client-generated UUID and the server MAY use this *Id*.\nIf the server does not use the client-specified *ID* field it shall issue its own *ID* for the resource.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEvent" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the new resource.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the new resource." + } + } + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains a URI to query creation status." + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/locations/{location-scheme}/{location-id}/treatments": { + "get": { + "operationId": "get-Treatments", + "summary": "Get the treatments for a certain location", + "description": "# Purpose\nProvides the animal health treatments for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the treatments for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Treatment", + "summary": "Add a single new health treatment event", + "description": "# Purpose \nAllows a client to add a single animal health treatment event.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health treatment event to create. \nA client MAY fill in the *ID* field with a client-generated UUID and the server MAY use this *ID*.\nIf the server does not use the client-specified *ID* field it shall issue its own *ID* for the resource.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEvent" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the new resource." + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status." + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/locations/{location-scheme}/{location-id}/treatment-programs": { + "get": { + "operationId": "get-Treatment-Programs", + "summary": "Get the treatment programs for a certain location", + "description": "# Purpose\nProvides the animal health treatment programs for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the treatment progams for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Treatment-Program", + "summary": "Add a single new health treatment programme.", + "description": "# Purpose \nAllows a client to add a single animal health treatment programme.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health treatment programme resource to create. \nA client MAY fill in the *ID* field with a client-generated UUID and the server MAY use this *ID*.\nIf the server does not use the client-specified *ID* field it shall issue its own *ID* for the resource.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\nThis applies to all resource *ID* and *meta* objects in the *icarTreatmentProgramEvent*.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEvent" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the new resource." + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status." + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/batches/{location-scheme}/{location-id}/diagnoses": { + "post": { + "operationId": "post-batch-Diagnosis", + "summary": "Add a single new diagnosis event", + "description": "# Purpose \nAllows a client to add a collection of animal health diagnosis events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health diagnosis events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventArray" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a set of batch results, which may include warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + }, + "201": { + "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the results." + } + } + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains a URI to query creation status." + } + } + }, + "default": { + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + } + } + } + }, + "/batches/{location-scheme}/{location-id}/treatments": { + "post": { + "operationId": "post-batch-Treatments", + "summary": "Add a collection of health treatment events", + "description": "# Purpose \nAllows a client to add a collection of animal health treatment events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health treatment events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEventArray" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a set of batch results, which may include warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + }, + "201": { + "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the results." + } + } + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains a URI to query creation status." + } + } + }, + "default": { + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + } + } + } + }, + "/batches/{location-scheme}/{location-id}/treatment-programs": { + "post": { + "operationId": "post-batch-Treatment-Program", + "summary": "Add a collection of animal health treatment program events.", + "description": "# Purpose \nAllows a client to add a collection of animal health treatment program events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health treatment program events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEventArray" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a set of batch results, which may include warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + }, + "201": { + "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the results." + } + } + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains a URI to query creation status." + } + } + }, + "default": { + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "batchResults": { + "type": "array", + "items": { + "$ref": "../resources/icarBatchResult.json" + } + }, + "error": { + "$ref": "../resources/icarResponseMessageResource.json" + }, + "icarDiagnosisEvent": { + "$ref": "../resources/icarDiagnosisEventResource.json" + }, + "icarDiagnosisEventCollection": { + "$ref": "../collections/icarDiagnosisEventCollection.json" + }, + "icarDiagnosisEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarDiagnosisEventResource.json" + } + }, + "icarTreatmentEvent": { + "$ref": "../resources/icarTreatmentEventResource.json" + }, + "icarTreatmentEventCollection": { + "$ref": "../collections/icarTreatmentEventCollection.json" + }, + "icarTreatmentEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarTreatmentEventResource.json" + } + }, + "icarTreatmentProgramEvent": { + "$ref": "../resources/icarTreatmentProgramEventResource.json" + }, + "icarTreatmentProgramEventCollection": { + "$ref": "../collections/icarTreatmentProgramEventCollection.json" + }, + "icarTreatmentProgramEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarTreatmentProgramEventResource.json" + } + } + }, + "parameters": { + "location-scheme": { + "name": "location-scheme", + "in": "path", + "description": "The scheme id for the location identifier.", + "required": true, + "schema": { + "type": "string" + } + }, + "location-id": { + "name": "location-id", + "in": "path", + "description": "The unique identifier for the location.", + "required": true, + "schema": { + "type": "string" + } + }, + "meta-modified-from": { + "name": "meta-modified-from", + "in": "query", + "description": "The start of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + "meta-modified-to": { + "name": "meta-modified-to", + "in": "query", + "description": "The end of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + "animal-scheme": { + "name": "animal-scheme", + "in": "query", + "description": "The scheme id for the animal identifier.", + "required": false, + "schema": { + "type": "string" + } + }, + "animal-id": { + "name": "animal-id", + "in": "query", + "description": "The unique identifier for the animal.", + "required": false, + "schema": { + "type": "string" + } + } + }, + "responses": { + "default": { + "description": "An error has occured while handling the request. Check the content of the message for the error details.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "A default response containing only a list of errors" + } + } + } + } + } + } +} \ No newline at end of file