diff --git a/server/lib/jackson/jackson-jaxrs-base-2.14.3.jar b/server/lib/jackson/jackson-jaxrs-base-2.14.3.jar new file mode 100644 index 0000000000..918d555f80 Binary files /dev/null and b/server/lib/jackson/jackson-jaxrs-base-2.14.3.jar differ diff --git a/server/lib/jackson/jackson-jaxrs-json-provider-2.14.3.jar b/server/lib/jackson/jackson-jaxrs-json-provider-2.14.3.jar new file mode 100644 index 0000000000..f1bd03599b Binary files /dev/null and b/server/lib/jackson/jackson-jaxrs-json-provider-2.14.3.jar differ diff --git a/server/lib/jackson/jackson-module-jaxb-annotations-2.14.3.jar b/server/lib/jackson/jackson-module-jaxb-annotations-2.14.3.jar new file mode 100644 index 0000000000..471403caee Binary files /dev/null and b/server/lib/jackson/jackson-module-jaxb-annotations-2.14.3.jar differ diff --git a/server/src/com/mirth/connect/client/core/api/ApiContentTypes.java b/server/src/com/mirth/connect/client/core/api/ApiContentTypes.java new file mode 100644 index 0000000000..9414964b6d --- /dev/null +++ b/server/src/com/mirth/connect/client/core/api/ApiContentTypes.java @@ -0,0 +1,9 @@ +package com.mirth.connect.client.core.api; + +/** + * This class contains custom MIME types used by the Mirth API. + */ +public class ApiContentTypes { + /** Custom MIME type for Mirth API JSON responses */ + public static final String APPLICATION_MIRTHAPI_JSON = "application/mirthapi+json"; +} \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/providers/JacksonJsonObjectMapperConfig.java b/server/src/com/mirth/connect/client/core/api/providers/JacksonJsonObjectMapperConfig.java new file mode 100644 index 0000000000..20d8909fe3 --- /dev/null +++ b/server/src/com/mirth/connect/client/core/api/providers/JacksonJsonObjectMapperConfig.java @@ -0,0 +1,30 @@ +package com.mirth.connect.client.core.api.providers; + +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +@Provider +public class JacksonJsonObjectMapperConfig implements ContextResolver { + + private final ObjectMapper objectMapper; + + public JacksonJsonObjectMapperConfig() { + objectMapper = new ObjectMapper(); + // Be forward compatible with unknown properties + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + // Match the Swagger documented format for dates and null handling + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + } + + @Override + public ObjectMapper getContext(Class aClass) { + return objectMapper; + } +} \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/servlets/AlertServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/AlertServletInterface.java index ae5742d903..08eedf0cb4 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/AlertServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/AlertServletInterface.java @@ -37,6 +37,7 @@ import com.mirth.connect.client.core.Permissions; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.Param; import com.mirth.connect.model.ChannelHeader; import com.mirth.connect.model.alert.AlertInfo; @@ -45,8 +46,8 @@ @Path("/alerts") @Tag(name = "Alerts") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface AlertServletInterface extends BaseServletInterface { @POST @@ -58,7 +59,8 @@ public void createAlert( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }) }) AlertModel alertModel) + @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON) }) AlertModel alertModel) throws ClientException; @GET @@ -68,7 +70,8 @@ public void createAlert( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }), }) + @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW) public AlertModel getAlert( @Param("alertId") @Parameter(description = "The ID of the alert.", required = true) @PathParam("alertId") String alertId) @@ -81,7 +84,8 @@ public AlertModel getAlert( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }), }) + @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW) public List getAlerts( @Param("alertIds") @Parameter(description = "The ID of the alert(s). If absent, all alerts will be returned.") @QueryParam("alertId") Set alertIds) @@ -94,14 +98,17 @@ public List getAlerts( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }) }) + @ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW) public List getAlertsPost( @Param("alertIds") @RequestBody(description = "The ID of the alert(s). If absent, all alerts will be returned.", content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_json") }) }) Set alertIds) + @ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) + Set alertIds) throws ClientException; @GET @@ -111,7 +118,8 @@ public List getAlertsPost( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_json") }) }) + @ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlertStatusList", display = "Get alert status list", permission = Permissions.ALERTS_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getAlertStatusList() throws ClientException; @@ -122,7 +130,8 @@ public List getAlertsPost( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }) }) + @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlertInfo", display = "Get alert info", permission = Permissions.ALERTS_VIEW, auditable = false) public AlertInfo getAlertInfo(// @formatter:off @Param("alertId") @Parameter(description = "The ID of the alert.", required = true) @PathParam("alertId") String alertId, @@ -130,7 +139,9 @@ public AlertInfo getAlertInfo(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }) }) Map cachedChannels) + @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) + Map cachedChannels) throws ClientException; // @formatter:on @@ -141,23 +152,28 @@ public AlertInfo getAlertInfo(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }) }) + @ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlertInfo", display = "Get alert info", permission = Permissions.ALERTS_VIEW) public AlertInfo getAlertInfo( @Param("cachedChannels") @RequestBody(description = "A map of ChannelHeader objects telling the server the state of the client-side channel cache.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }) }) Map cachedChannels) + @ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) + Map cachedChannels) throws ClientException; @GET @Path("/options") @Operation(summary = "Returns all alert protocol options.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_json") }) }) + @ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAlertProtocolOptions", display = "Get alert protocol options", permission = Permissions.ALERTS_VIEW, auditable = false) public Map> getAlertProtocolOptions() throws ClientException; @@ -171,7 +187,9 @@ public void updateAlert(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }) }) AlertModel alertModel) + @ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) + AlertModel alertModel) throws ClientException; // @formatter:on diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ChannelGroupServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ChannelGroupServletInterface.java index f223750a21..9260e441b1 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ChannelGroupServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ChannelGroupServletInterface.java @@ -34,6 +34,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -41,38 +42,43 @@ @Path("/channelgroups") @Tag(name = "Channel Groups") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ChannelGroupServletInterface extends BaseServletInterface { @GET @Path("/") @Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) }) + @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelGroups(@Param("channelGroupIds") @Parameter(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.") @QueryParam("channelGroupId") Set channelGroupIds) throws ClientException; @POST @Path("/_getChannelGroups") @Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID. This is a POST request alternative to GET /channelgroups that may be used when there are too many channel group IDs to include in the query parameters.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) }) + @ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelGroupsPost(@Param("channelGroupIds") @RequestBody(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.", content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }) }) Set channelGroupIds) throws ClientException; + @ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelGroupIds) throws ClientException; @POST @Path("/_bulkUpdate") @Consumes(MediaType.MULTIPART_FORM_DATA) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) @Operation(summary = "Updates all channel groups in one request. " + SWAGGER_TRY_IT_OUT_DISCLAIMER) @MirthOperation(name = "updateChannelGroups", display = "Update channel groups", permission = Permissions.CHANNELS_MANAGE) public boolean updateChannelGroups(// @formatter:off diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ChannelServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ChannelServletInterface.java index fa32cb3e42..fe2c7b4f63 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ChannelServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ChannelServletInterface.java @@ -38,6 +38,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -50,33 +51,35 @@ @Path("/channels") @Tag(name = "Channels") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ChannelServletInterface extends BaseServletInterface { @POST @Path("/") @Operation(summary = "Creates a new channel.") @MirthOperation(name = "createChannel", display = "Create channel", permission = Permissions.CHANNELS_MANAGE) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) public boolean createChannel( @Param("channel") @RequestBody(description = "The Channel object to create.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Channel.class), examples = { @ExampleObject(name = "channel", ref = "../apiexamples/channel_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Channel.class), examples = { - @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }) }) Channel channel) + @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Channel channel) throws ClientException; @GET @Path("/") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) @Operation(summary = "Retrieve a list of all channels, or multiple channels by ID.") @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelList", ref = "../apiexamples/channel_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelList", ref = "../apiexamples/channel_list_json") }) }) + @ExampleObject(name = "channelList", ref = "../apiexamples/channel_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannels", display = "Get channels", permission = Permissions.CHANNELS_VIEW) public List getChannels( @Param("channelIds") @Parameter(description = "The IDs of the channels to retrieve. If absent, all channels will be retrieved.") @QueryParam("channelId") Set channelIds, @@ -91,14 +94,16 @@ public List getChannels( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel", ref = "../apiexamples/channel_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel", ref = "../apiexamples/channel_list_json") }) }) + @ExampleObject(name = "channel", ref = "../apiexamples/channel_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannels", display = "Get channels", permission = Permissions.CHANNELS_VIEW) public List getChannelsPost( @Param("channelIds") @RequestBody(description = "The IDs of the channels to retrieve. If absent, all channels will be retrieved.", content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }) }) Set channelIds, + @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("pollingOnly") @Parameter(description = "If true, only channels with polling source connectors will be returned.") @QueryParam("pollingOnly") boolean pollingOnly, @Param("includeCodeTemplateLibraries") @Parameter(description = "If true, code template libraries will be included in the channel.") @QueryParam("includeCodeTemplateLibraries") boolean includeCodeTemplateLibraries) throws ClientException; @@ -110,7 +115,8 @@ public List getChannelsPost( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel", ref = "../apiexamples/channel_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }) }) + @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannel", display = "Get channel", permission = Permissions.CHANNELS_VIEW) public Channel getChannel( @Param("channelId") @Parameter(description = "The ID of the channel to retrieve.", required = true) @PathParam("channelId") String channelId, @@ -124,7 +130,8 @@ public Channel getChannel( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "connectorNameMap", ref = "../apiexamples/connector_name_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connectorNameMap", ref = "../apiexamples/connector_name_map_json") }) }) + @ExampleObject(name = "connectorNameMap", ref = "../apiexamples/connector_name_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getConnectorNames", display = "Get connector names", permission = Permissions.MESSAGES_VIEW, auditable = false) public Map getConnectorNames( @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId) @@ -137,7 +144,8 @@ public Map getConnectorNames( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "metadataColumnList", ref = "../apiexamples/metadatacolumn_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "metadataColumnList", ref = "../apiexamples/metadatacolumn_list_json") }) }) + @ExampleObject(name = "metadataColumnList", ref = "../apiexamples/metadatacolumn_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getMetaDataColumns", display = "Get metadata columns", permission = Permissions.MESSAGES_VIEW, auditable = false) public List getMetaDataColumns( @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId) @@ -150,7 +158,8 @@ public List getMetaDataColumns( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelNameMap", ref = "../apiexamples/guid_to_name_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelNameMap", ref = "../apiexamples/guid_to_name_map_json") }) }) + @ExampleObject(name = "channelNameMap", ref = "../apiexamples/guid_to_name_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelIdsAndNames", display = "Get channel IDs and names", permission = Permissions.CHANNELS_VIEW, type = ExecuteType.ASYNC, auditable = false) public Map getChannelIdsAndNames() throws ClientException; @@ -162,7 +171,8 @@ public List getMetaDataColumns( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "ports_used", ref = "../apiexamples/ports_used_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "ports_used", ref = "../apiexamples/ports_used_json") }) }) + @ExampleObject(name = "ports_used", ref = "../apiexamples/ports_used_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelPortsInUse", display = "Get Ports In Use", permission = Permissions.CHANNELS_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelPortsInUse() throws ClientException; @@ -174,14 +184,17 @@ public List getMetaDataColumns( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelSummaryList", ref = "../apiexamples/channel_summary_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelSummaryList", ref = "../apiexamples/channel_summary_list_json") }) }) + @ExampleObject(name = "channelSummaryList", ref = "../apiexamples/channel_summary_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelSummary", display = "Get channel summary", permission = Permissions.CHANNELS_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelSummary(// @formatter:off @Param("cachedChannels") @RequestBody(description = "A map of ChannelHeader objects telling the server the state of the client-side channel cache.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "cachedChannels", ref = "../apiexamples/channel_header_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "cachedChannels", ref = "../apiexamples/channel_header_map_json") }) }) Map cachedChannels, + @ExampleObject(name = "cachedChannels", ref = "../apiexamples/channel_header_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) + Map cachedChannels, @Param("ignoreNewChannels") @Parameter(description = "If true, summaries will only be returned for channels in the map's entry set.", required = true) @QueryParam("ignoreNewChannels") boolean ignoreNewChannels) throws ClientException; // @formatter: on @@ -236,14 +249,15 @@ public void setChannelInitialState(// @formatter:off @Path("/{channelId}") @Operation(summary = "Updates the specified channel.") @MirthOperation(name = "updateChannel", display = "Update channel", permission = Permissions.CHANNELS_MANAGE) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) public boolean updateChannel(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel to update.", required = true) @PathParam("channelId") String channelId, @Param("channel") @RequestBody(description = "The Channel object to update with.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Channel.class), examples = { @ExampleObject(name = "channel", ref = "../apiexamples/channel_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Channel.class), examples = { - @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }) }) Channel channel, + @ExampleObject(name = "channel", ref = "../apiexamples/channel_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Channel channel, @Param("override") @Parameter(description = "If true, the channel will be updated even if a different revision exists on the server.", schema = @Schema(defaultValue = "false")) @QueryParam("override") boolean override, @Param("startEdit") @Parameter(description = "Date and time starting to edit this channel. Example: 1985-10-26T09:00:00.000-0700") @QueryParam("startEdit") String startEdit) throws ClientException; @@ -274,6 +288,7 @@ public void removeChannelsPost( @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }) }) Set channelIds) + @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds) throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatisticsServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatisticsServletInterface.java index a6ba58b07e..b96de4a0ba 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatisticsServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatisticsServletInterface.java @@ -34,6 +34,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -41,17 +42,19 @@ @Path("/channels") @Tag(name = "Channel Statistics") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ChannelStatisticsServletInterface extends BaseServletInterface { @GET @Path("/statistics") @Operation(summary = "Returns the Statistics for all channels.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_json") }) }) + @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAllStatistics", display = "Get all statistics", permission = Permissions.DASHBOARD_VIEW, auditable = false) public List getStatistics(//@formatter:off @Param("channelIds") @Parameter(description = "The IDs of the channels to retrieve. If absent, all channels will be retrieved.") @QueryParam("channelId") Set channelIds, @@ -65,10 +68,12 @@ public List getStatistics(//@formatter:off @Path("/statistics/_getStatistics") @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(summary = "Returns the Statistics for all channels. This is a POST request alternative to GET /statistics that may be used when there are too many channel IDs to include in the query parameters.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_json") }) }) + @ExampleObject(name = "channel_statistics_list", ref = "../apiexamples/channel_statistics_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAllStatistics", display = "Get all statistics", permission = Permissions.DASHBOARD_VIEW, auditable = false) public List getStatisticsPost(//@formatter:off @Param("channelIds") @Parameter(description = "The IDs of the channels to retrieve. If absent, all channels will be retrieved.") @FormDataParam("channelIds") Set channelIds, @@ -81,10 +86,12 @@ public List getStatisticsPost(//@formatter:off @GET @Path("/{channelId}/statistics") @Operation(summary = "Returns the Statistics for the channel with the specified id.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channel_statistics", ref = "../apiexamples/channel_statistics_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channel_statistics", ref = "../apiexamples/channel_statistics_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_statistics", ref = "../apiexamples/channel_statistics_json") }) }) + @ExampleObject(name = "channel_statistics", ref = "../apiexamples/channel_statistics_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getStatistics", display = "Get statistics", permission = Permissions.DASHBOARD_VIEW, auditable = false) public ChannelStatistics getStatistics(@Param("channelId") @Parameter(description = "The ID of the channel to retrieve statistics for.", required = true) @PathParam("channelId") String channelId) throws ClientException; @@ -98,7 +105,8 @@ public void clearStatistics(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "connector_map", ref = "../apiexamples/connector_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connector_map", ref = "../apiexamples/connector_map_json") }) }) + @ExampleObject(name = "connector_map", ref = "../apiexamples/connector_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map> channelConnectorMap, @Param("received") @Parameter(description = "If true, received stats will be cleared.") @QueryParam("received") boolean received, diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatusServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatusServletInterface.java index 18e64c5b28..8db14656f7 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatusServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ChannelStatusServletInterface.java @@ -35,6 +35,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -43,27 +44,31 @@ @Path("/channels") @Tag(name = "Channel Status Operations") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ChannelStatusServletInterface extends BaseServletInterface { @GET @Path("/{channelId}/status") @Operation(summary = "Returns the dashboard status for a single channel ID.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboard_status", ref = "../apiexamples/dashboard_status_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboard_status", ref = "../apiexamples/dashboard_status_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboard_status", ref = "../apiexamples/dashboard_status_json") }) }) + @ExampleObject(name = "dashboard_status", ref = "../apiexamples/dashboard_status_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelStatus", display = "Get status for single channel", permission = Permissions.DASHBOARD_VIEW, type = ExecuteType.ASYNC, auditable = false) public DashboardStatus getChannelStatus(@Param("channelId") @Parameter(description = "The channel ID to return a dashboard status for.") @PathParam("channelId") String channelId) throws ClientException; @GET @Path("/statuses") @Operation(summary = "Returns all channel dashboard statuses, or multiple statuses by channel ID.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_json") }) }) + @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelStatusList", display = "Get status list for specific channels", permission = Permissions.DASHBOARD_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelStatusList(// @formatter:off @Param("channelIds") @Parameter(description = "The channel IDs to return dashboard statuses for. If absent, all statuses will be returned.") @QueryParam("channelId") Set channelIds, @@ -74,10 +79,12 @@ public List getChannelStatusList(// @formatter:off @POST @Path("/statuses/_getChannelStatusList") @Operation(summary = "Returns all channel dashboard statuses, or multiple statuses by channel ID. This is a POST request alternative to GET /statuses that may be used when there are too many channel IDs to include in the query parameters.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_json") }) }) + @ExampleObject(name = "dashboard_status_list", ref = "../apiexamples/dashboard_status_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelStatusList", display = "Get status list for specific channels", permission = Permissions.DASHBOARD_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getChannelStatusListPost(// @formatter:off @Param("channelIds") @@ -85,7 +92,8 @@ public List getChannelStatusListPost(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }) }) + @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("filter") @Parameter(description = "The filter string to limit dashboard statuses with.") @QueryParam("filter") String filter, @@ -95,10 +103,12 @@ public List getChannelStatusListPost(// @formatter:off @GET @Path("/statuses/initial") @Operation(summary = "Returns a DashboardChannelInfo object containing a partial channel status list and a set of remaining channel IDs.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboard_channel_info", ref = "../apiexamples/dashboard_channel_info_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboard_channel_info", ref = "../apiexamples/dashboard_channel_info_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboard_channel_info", ref = "../apiexamples/dashboard_channel_info_json") }) }) + @ExampleObject(name = "dashboard_channel_info", ref = "../apiexamples/dashboard_channel_info_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelStatusListInitial", display = "Get initial channel status list", permission = Permissions.DASHBOARD_VIEW, type = ExecuteType.ASYNC, auditable = false) public DashboardChannelInfo getDashboardChannelInfo(// @formatter:off @Param("fetchSize") @Parameter(description = "Specifies the maximum number of statuses to return.", required = true, schema = @Schema(defaultValue = "100")) @QueryParam("fetchSize") int fetchSize, @@ -220,7 +230,8 @@ public void startConnectors(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_json") }) }) + @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map> connectorInfo, @Param("returnErrors") @Parameter(description = "If true, an error response code and the exception will be returned.") @QueryParam("returnErrors") boolean returnErrors) throws ClientException; @@ -246,7 +257,8 @@ public void stopConnectors(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_json") }) }) + @ExampleObject(name = "start_connector_map", ref = "../apiexamples/start_connector_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map> connectorInfo, @Param("returnErrors") @Parameter(description = "If true, an error response code and the exception will be returned.") @QueryParam("returnErrors") boolean returnErrors) throws ClientException; diff --git a/server/src/com/mirth/connect/client/core/api/servlets/CodeTemplateServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/CodeTemplateServletInterface.java index e435436c41..89f1ac175d 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/CodeTemplateServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/CodeTemplateServletInterface.java @@ -38,6 +38,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -48,19 +49,21 @@ @Path("/") @Tag(name = "Code Templates") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface CodeTemplateServletInterface extends BaseServletInterface { @GET @Path("/codeTemplateLibraries") @Operation(summary = "Retrieves multiple code template libraries by ID, or all libraries if not specified.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_xml"), - @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_xml"), + @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_json"), - @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }) }) + @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplateLibraries", display = "Get code template libraries", permission = Permissions.CODE_TEMPLATES_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getCodeTemplateLibraries(// @formatter:off @Param("libraryIds") @Parameter(description = "The ID of the library(s) to retrieve.") @QueryParam("libraryId") Set libraryIds, @@ -70,12 +73,14 @@ public List getCodeTemplateLibraries(// @formatter:off @POST @Path("/codeTemplateLibraries/_getCodeTemplateLibraries") @Operation(summary = "Retrieves multiple code template libraries by ID, or all libraries if not specified. This is a POST request alternative to GET /codeTemplateLibraries that may be used when there are too many library IDs to include in the query parameters.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_xml"), - @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_xml"), + @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { @ExampleObject(name = "code_template_library_list", ref = "../apiexamples/code_template_library_list_json"), - @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }) }) + @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplateLibraries", display = "Get code template libraries", permission = Permissions.CODE_TEMPLATES_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getCodeTemplateLibrariesPost(// @formatter:off @Param("libraryIds") @@ -83,7 +88,8 @@ public List getCodeTemplateLibrariesPost(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "code_template_library_id_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_library_id_set", ref = "../apiexamples/guid_set_json") }) }) + @ExampleObject(name = "code_template_library_id_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set libraryIds, @Param("includeCodeTemplates") @Parameter(description = "If true, full code templates will be included inside each library.", schema = @Schema(defaultValue = "false")) @QueryParam("includeCodeTemplates") boolean includeCodeTemplates) throws ClientException; // @formatter:on @@ -91,12 +97,14 @@ public List getCodeTemplateLibrariesPost(// @formatter:off @GET @Path("/codeTemplateLibraries/{libraryId}") @Operation(summary = "Retrieves a single code template library.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_library", ref = "../apiexamples/code_template_library_xml"), - @ExampleObject(name = "code_template_library_full_templates", ref = "../apiexamples/code_template_library_full_templates_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_library", ref = "../apiexamples/code_template_library_xml"), + @ExampleObject(name = "code_template_library_full_templates", ref = "../apiexamples/code_template_library_full_templates_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { @ExampleObject(name = "code_template_library", ref = "../apiexamples/code_template_library_json"), - @ExampleObject(name = "code_template_library_full_templates", ref = "../apiexamples/code_template_library_full_templates_json") }) }) + @ExampleObject(name = "code_template_library_full_templates", ref = "../apiexamples/code_template_library_full_templates_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplateLibrary", display = "Get code template library", permission = Permissions.CODE_TEMPLATES_VIEW, type = ExecuteType.ASYNC) public CodeTemplateLibrary getCodeTemplateLibrary(// @formatter:off @Param("libraryId") @Parameter(description = "The ID of the library to retrieve.") @PathParam("libraryId") String libraryId, @@ -106,10 +114,12 @@ public CodeTemplateLibrary getCodeTemplateLibrary(// @formatter:off @PUT @Path("/codeTemplateLibraries") @Operation(summary = "Replaces all code template libraries.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "libraries_replaced", ref = "../apiexamples/boolean_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "libraries_replaced", ref = "../apiexamples/boolean_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "libraries_replaced", ref = "../apiexamples/boolean_json") }) }) + @ExampleObject(name = "libraries_replaced", ref = "../apiexamples/boolean_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "updateCodeTemplateLibraries", display = "Update code template libraries", permission = Permissions.CODE_TEMPLATES_MANAGE) public boolean updateCodeTemplateLibraries(// @formatter:off @Param("libraries") @@ -117,7 +127,8 @@ public boolean updateCodeTemplateLibraries(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }) }) + @ExampleObject(name = "code_template_library_list_full_templates", ref = "../apiexamples/code_template_library_list_full_templates_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) List libraries, @Param("override") @Parameter(description = "If true, the code template library will be updated even if a different revision exists on the server.", schema = @Schema(defaultValue = "false")) @QueryParam("override") boolean override) throws ClientException; // @formatter:on @@ -125,60 +136,72 @@ public boolean updateCodeTemplateLibraries(// @formatter:off @GET @Path("/codeTemplates") @Operation(summary = "Retrieves multiple code templates by ID, or all templates if not specified.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_json") }) }) + @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplates", display = "Get code templates", permission = Permissions.CODE_TEMPLATES_VIEW) public List getCodeTemplates(@Param("codeTemplateIds") @Parameter(description = "The ID of the code template(s) to retrieve.") @QueryParam("codeTemplateId") Set codeTemplateIds) throws ClientException; @POST @Path("/codeTemplates/_getCodeTemplates") @Operation(summary = "Retrieves multiple code templates by ID, or all templates if not specified. This is a POST request alternative to GET /codeTemplates that may be used when there are too many code template IDs to include in the query parameters.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_json") }) }) + @ExampleObject(name = "code_template_list", ref = "../apiexamples/code_template_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplates", display = "Get code templates", permission = Permissions.CODE_TEMPLATES_VIEW) public List getCodeTemplatesPost(@Param("codeTemplateIds") @RequestBody(description = "The ID of the code template(s) to retrieve.", content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "code_template_id_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_id_set", ref = "../apiexamples/guid_set_json") }) }) Set codeTemplateIds) throws ClientException; + @ExampleObject(name = "code_template_id_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set codeTemplateIds) throws ClientException; @GET @Path("/codeTemplates/{codeTemplateId}") @Operation(summary = "Retrieves a single code template.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_json") }) }) + @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplates", display = "Get code templates", permission = Permissions.CODE_TEMPLATES_VIEW) public CodeTemplate getCodeTemplate(@Param("codeTemplateId") @Parameter(description = "The ID of the code template to retrieve.") @PathParam("codeTemplateId") String codeTemplateId) throws ClientException; @POST @Path("/codeTemplates/_getSummary") @Operation(summary = "Returns a list of code template summaries, indicating to a client which code templates have changed. If a code template was modified, the entire CodeTemplate object will be returned.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_summary_list", ref = "../apiexamples/code_template_summary_list_xml"), - @ExampleObject(name = "code_template_summary_list_revision_changed", ref = "../apiexamples/code_template_summary_list_revision_changed_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_summary_list", ref = "../apiexamples/code_template_summary_list_xml"), + @ExampleObject(name = "code_template_summary_list_revision_changed", ref = "../apiexamples/code_template_summary_list_revision_changed_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { @ExampleObject(name = "code_template_summary_list", ref = "../apiexamples/code_template_summary_list_json"), - @ExampleObject(name = "code_template_summary_list_revision_changed", ref = "../apiexamples/code_template_summary_list_revision_changed_json") }) }) + @ExampleObject(name = "code_template_summary_list_revision_changed", ref = "../apiexamples/code_template_summary_list_revision_changed_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCodeTemplateSummary", display = "Get code template summary", permission = Permissions.CODE_TEMPLATES_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getCodeTemplateSummary(@Param("clientRevisions") @RequestBody(description = "A map of revisions telling the server the state of the client-side code template cache.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "guid_to_int_map", ref = "../apiexamples/guid_to_int_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "guid_to_int_map", ref = "../apiexamples/guid_to_int_map_json") }) }) Map clientRevisions) throws ClientException; + @ExampleObject(name = "guid_to_int_map", ref = "../apiexamples/guid_to_int_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map clientRevisions) throws ClientException; @PUT @Path("/codeTemplates/{codeTemplateId}") @Operation(summary = "Updates a single code template.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_replaced", ref = "../apiexamples/boolean_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_replaced", ref = "../apiexamples/boolean_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_replaced", ref = "../apiexamples/boolean_json") }) }) + @ExampleObject(name = "code_template_replaced", ref = "../apiexamples/boolean_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "updateCodeTemplate", display = "Update code template", permission = Permissions.CODE_TEMPLATES_MANAGE) public boolean updateCodeTemplate(// @formatter:off @Param("codeTemplateId") @Parameter(description = "The ID of the code template.", required = true) @PathParam("codeTemplateId") String codeTemplateId, @@ -188,7 +211,8 @@ public boolean updateCodeTemplate(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_json") }) }) + @ExampleObject(name = "code_template", ref = "../apiexamples/code_template_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) CodeTemplate codeTemplate, @Param("override") @Parameter(description = "If true, the code template will be updated even if a different revision exists on the server.", schema = @Schema(defaultValue = "false")) @QueryParam("override") boolean override) throws ClientException; @@ -204,10 +228,12 @@ public boolean updateCodeTemplate(// @formatter:off @Path("/codeTemplateLibraries/_bulkUpdate") @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(summary = "Updates all libraries and updates/removes selected code templates in one request. " + SWAGGER_TRY_IT_OUT_DISCLAIMER) - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "code_template_library_saved_result", ref = "../apiexamples/code_template_library_saved_result_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "code_template_library_saved_result", ref = "../apiexamples/code_template_library_saved_result_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "code_template_library_saved_result", ref = "../apiexamples/code_template_library_saved_result_json") }) }) + @ExampleObject(name = "code_template_library_saved_result", ref = "../apiexamples/code_template_library_saved_result_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "updateCodeTemplatesAndLibraries", display = "Update code templates and libraries", permission = Permissions.CODE_TEMPLATES_MANAGE) public CodeTemplateLibrarySaveResult updateLibrariesAndTemplates(// @formatter:off @Param("libraries") diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java index 9f8d391bfe..50f3c4188c 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java @@ -37,6 +37,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -59,8 +60,8 @@ @Path("/server") @Tag(name = "Server Configuration") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ConfigurationServletInterface extends BaseServletInterface { @GET @@ -91,7 +92,8 @@ public interface ConfigurationServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "status", ref = "../apiexamples/integer_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "status", ref = "../apiexamples/integer_json") }) }) + @ExampleObject(name = "status", ref = "../apiexamples/integer_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getStatus", display = "Get status") public int getStatus() throws ClientException; @@ -109,7 +111,8 @@ public interface ConfigurationServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "serverTime", ref = "../apiexamples/calendar_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverTime", ref = "../apiexamples/calendar_json") }) }) + @ExampleObject(name = "serverTime", ref = "../apiexamples/calendar_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getServerTime", display = "Get server time", auditable = false) public Calendar getServerTime() throws ClientException; @@ -127,17 +130,20 @@ public interface ConfigurationServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "aboutMap", ref = "../apiexamples/generic_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "aboutMap", ref = "../apiexamples/generic_map_json") }) }) + @ExampleObject(name = "aboutMap", ref = "../apiexamples/generic_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAbout", display = "Get about information", auditable = false) public Map getAbout() throws ClientException; @GET @Path("/configuration") @Operation(summary = "Returns a ServerConfiguration object which contains all of the channels, alerts, configuration map, and properties stored on the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_json") }) }) + @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getServerConfiguration", display = "Get server configuration", permission = Permissions.SERVER_CONFIGURATION_BACKUP) public ServerConfiguration getServerConfiguration(// @formatter:off @Param("initialState") @Parameter(description = "The initial state to set all channels in the configuration to.", schema = @Schema(allowableValues = {"STARTED", "PAUSED", "STOPPED"}, type = "string")) @QueryParam("initialState") DeployedState initialState, @@ -154,7 +160,8 @@ public void setServerConfiguration(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_json") }) }) ServerConfiguration serverConfiguration, + @ExampleObject(name = "serverConfiguration", ref = "../apiexamples/server_configuration_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) ServerConfiguration serverConfiguration, @Param("deploy") @Parameter(description = "If true, all enabled channels will be deployed after the configuration is restored.", schema = @Schema(defaultValue = "false")) @QueryParam(value = "deploy") boolean deploy, @Param("overwriteConfigMap") @Parameter(description = "If true, overwrite the Configuration Map") @QueryParam(value = "overwriteConfigMap") boolean overwriteConfigMap) throws ClientException; // @formatter:on @@ -162,20 +169,24 @@ public void setServerConfiguration(// @formatter:off @GET @Path("/charsets") @Operation(summary = "Returns a List of all of the charset encodings supported by the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "charsetEncodings", ref = "../apiexamples/charset_encoding_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "charsetEncodings", ref = "../apiexamples/charset_encoding_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "charsetEncodings", ref = "../apiexamples/charset_encoding_list_json") }) }) + @ExampleObject(name = "charsetEncodings", ref = "../apiexamples/charset_encoding_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAvailableCharsetEncodings", display = "Get available charset encodings", auditable = false) public List getAvailableCharsetEncodings() throws ClientException; @GET @Path("/settings") @Operation(summary = "Returns a ServerSettings object with all server settings.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_json") }) }) + @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getServerSettings", display = "Get server settings", permission = Permissions.SERVER_SETTINGS_VIEW, auditable = false) public ServerSettings getServerSettings() throws ClientException; @@ -187,15 +198,18 @@ public void setServerSettings(@Param("settings") @RequestBody(description = "The @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_json") }) }) ServerSettings settings) throws ClientException; + @ExampleObject(name = "serverSettings", ref = "../apiexamples/server_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) ServerSettings settings) throws ClientException; @GET @Path("/publicSettings") @Operation(summary = "Returns a PublicServerSettings object containing server settings available to all users.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "publicServerSettings", ref = "../apiexamples/public_server_settings_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "publicServerSettings", ref = "../apiexamples/public_server_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "publicServerSettings", ref = "../apiexamples/public_server_settings_json") }) }) + @ExampleObject(name = "publicServerSettings", ref = "../apiexamples/public_server_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getPublicServerSettings", display = "Get public server settings", auditable = false) public PublicServerSettings getPublicServerSettings() throws ClientException; @@ -212,10 +226,12 @@ public String getProperty( @GET @Path("/encryption") @Operation(summary = "Returns an EncryptionSettings object with all encryption settings.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "encryptionSettings", ref = "../apiexamples/encryption_settings_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "encryptionSettings", ref = "../apiexamples/encryption_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "encryptionSettings", ref = "../apiexamples/encryption_settings_json") }) }) + @ExampleObject(name = "encryptionSettings", ref = "../apiexamples/encryption_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getEncryptionSettings", display = "Get encryption settings") public EncryptionSettings getEncryptionSettings() throws ClientException; @@ -227,15 +243,18 @@ public ConnectionTestResponse sendTestEmail(@Param("properties") @RequestBody(de @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Properties.class), examples = { @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Properties.class), examples = { - @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }) }) Properties properties) throws ClientException; + @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Properties properties) throws ClientException; @GET @Path("/updateSettings") @Operation(summary = "Returns an UpdateSettings object with all update settings.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_json") }) }) + @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getUpdateSettings", display = "Get update settings", auditable = false) public UpdateSettings getUpdateSettings() throws ClientException; @@ -247,15 +266,18 @@ public void setUpdateSettings(@Param("settings") @RequestBody(description = "The @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "updateSetings", ref = "../apiexamples/update_settings_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_json") }) }) UpdateSettings settings) throws ClientException; + @ExampleObject(name = "updateSettings", ref = "../apiexamples/update_settings_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) UpdateSettings settings) throws ClientException; @GET @Path("/licenseInfo") @Operation(summary = "Returns a LicenseInfo object with the expiration date and other information.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "licenseInfo", ref = "../apiexamples/license_info_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "licenseInfo", ref = "../apiexamples/license_info_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "licenseInfo", ref = "../apiexamples/license_info_json") }) }) + @ExampleObject(name = "licenseInfo", ref = "../apiexamples/license_info_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getLicenseInfo", display = "Get license info", auditable = false) public LicenseInfo getLicenseInfo() throws ClientException; @@ -269,10 +291,12 @@ public void setUpdateSettings(@Param("settings") @RequestBody(description = "The @GET @Path("/globalScripts") @Operation(summary = "Returns a map containing all of the global scripts.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_json") }) }) + @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getGlobalScripts", display = "Get global scripts", permission = Permissions.GLOBAL_SCRIPTS_VIEW) public Map getGlobalScripts() throws ClientException; @@ -284,15 +308,18 @@ public void setGlobalScripts(@Param("scripts") @RequestBody(description = "The m @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_json") }) }) Map scripts) throws ClientException; + @ExampleObject(name = "globalScripts", ref = "../apiexamples/global_scripts_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map scripts) throws ClientException; @GET @Path("/configurationMap") @Operation(summary = "Returns all entries in the configuration map.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_json") }) }) + @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getConfigurationMap", display = "Get configuration map", permission = Permissions.CONFIGURATION_MAP_VIEW) public Map getConfigurationMap() throws ClientException; @@ -304,15 +331,18 @@ public void setConfigurationMap(@Param("map") @RequestBody(description = "The ne @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_json") }) }) Map map) throws ClientException; + @ExampleObject(name = "configurationMap", ref = "../apiexamples/configuration_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map map) throws ClientException; @GET @Path("/databaseDrivers") @Operation(summary = "Returns the database driver list.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_json") }) }) + @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getDatabaseDrivers", display = "Get database drivers", auditable = false, type = ExecuteType.ASYNC) public List getDatabaseDrivers() throws ClientException; @@ -324,25 +354,30 @@ public void setDatabaseDrivers(@Param("drivers") @RequestBody(description = "The @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_json") }) }) List drivers) throws ClientException; + @ExampleObject(name = "driverInfoList", ref = "../apiexamples/driver_info_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) List drivers) throws ClientException; @GET @Path("/passwordRequirements") @Operation(summary = "Returns all password requirements for the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "passwordRequirements", ref = "../apiexamples/password_requirements_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "passwordRequirements", ref = "../apiexamples/password_requirements_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "passwordRequirements", ref = "../apiexamples/password_requirements_json") }) }) + @ExampleObject(name = "passwordRequirements", ref = "../apiexamples/password_requirements_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getPasswordRequirements", display = "Get password requirements") public PasswordRequirements getPasswordRequirements() throws ClientException; @GET @Path("/resources") @Operation(summary = "Returns all resources for the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_json") }) }) + @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getResources", display = "Get resources", permission = Permissions.RESOURCES_VIEW, type = ExecuteType.ASYNC) public List getResources() throws ClientException; @@ -354,7 +389,8 @@ public void setResources(@Param("resources") @RequestBody(description = "The new @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_json") }) }) List resources) throws ClientException; + @ExampleObject(name = "resources", ref = "../apiexamples/resource_properties_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) List resources) throws ClientException; @POST @Path("/resources/{resourceId}/_reload") @@ -365,10 +401,12 @@ public void setResources(@Param("resources") @RequestBody(description = "The new @GET @Path("/channelDependencies") @Operation(summary = "Returns all channel dependencies for the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_json") }) }) + @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelDependencies", display = "Get channel dependencies", auditable = false) public Set getChannelDependencies() throws ClientException; @@ -380,15 +418,18 @@ public void setChannelDependencies(@Param("dependencies") @RequestBody(descripti @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_json") }) }) Set dependencies) throws ClientException; + @ExampleObject(name = "channelDependencies", ref = "../apiexamples/channel_dependency_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set dependencies) throws ClientException; @GET @Path("/channelMetadata") @Operation(summary = "Returns all channel metadata for the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_json") }) }) + @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelMetadata", display = "Get channel metadata", auditable = false) public Map getChannelMetadata() throws ClientException; @@ -400,25 +441,30 @@ public void setChannelMetadata(@Param("metadata") @RequestBody(description = "Th @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_json") }) }) Map metadata) throws ClientException; + @ExampleObject(name = "channelMetadata", ref = "../apiexamples/channel_metadata_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map metadata) throws ClientException; @GET @Path("/protocolsAndCipherSuites") @Operation(summary = "Returns a map containing all supported and enabled TLS protocols and cipher suites.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "protocolsAndCipherSuites", ref = "../apiexamples/protocols_and_cipher_suites_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "protocolsAndCipherSuites", ref = "../apiexamples/protocols_and_cipher_suites_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "protocolsAndCipherSuites", ref = "../apiexamples/protocols_and_cipher_suites_map_json") }) }) + @ExampleObject(name = "protocolsAndCipherSuites", ref = "../apiexamples/protocols_and_cipher_suites_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getProtocolsAndCipherSuites", display = "Get protocols and cipher suites", type = ExecuteType.ASYNC, auditable = false) public Map getProtocolsAndCipherSuites() throws ClientException; @GET @Path("/channelTags") @Operation(summary = "Returns a set containing all channel tags for the server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_json") }) }) + @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelTags", display = "Get channel tags", permission = Permissions.TAGS_VIEW, type = ExecuteType.ASYNC, auditable = false) public Set getChannelTags() throws ClientException; @@ -430,15 +476,18 @@ public void setChannelTags(@Param("channelTags") @RequestBody(description = "The @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_json") }) }) Set channelTags) throws ClientException; + @ExampleObject(name = "channelTags", ref = "../apiexamples/channel_tag_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelTags) throws ClientException; @GET @Path("/rhinoLanguageVersion") @Operation(summary = "Returns the language version that the Rhino engine should use.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "rhinoLanguageVersion", ref = "../apiexamples/integer_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "rhinoLanguageVersion", ref = "../apiexamples/integer_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "rhinoLanguageVersion", ref = "../apiexamples/integer_json") }) }) + @ExampleObject(name = "rhinoLanguageVersion", ref = "../apiexamples/integer_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getRhinoLanguageVersion", display = "Get rhino language version", type = ExecuteType.ASYNC, auditable = false) public int getRhinoLanguageVersion() throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/servlets/DatabaseTaskServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/DatabaseTaskServletInterface.java index b4715188db..557c080736 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/DatabaseTaskServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/DatabaseTaskServletInterface.java @@ -28,6 +28,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -35,27 +36,31 @@ @Path("/databaseTasks") @Tag(name = "Database Tasks") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DatabaseTaskServletInterface extends BaseServletInterface { @GET @Path("/") @Operation(summary = "Retrieves all current database tasks.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "database_task_map", ref = "../apiexamples/database_task_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "database_task_map", ref = "../apiexamples/database_task_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "database_task_map", ref = "../apiexamples/database_task_map_json") }) }) + @ExampleObject(name = "database_task_map", ref = "../apiexamples/database_task_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getDatabaseTasks", display = "Get database tasks", permission = Permissions.DATABASE_TASKS_VIEW) public Map getDatabaseTasks() throws ClientException; @GET @Path("/{databaseTaskId}") @Operation(summary = "Retrieves a single database task.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "database_task", ref = "../apiexamples/database_task_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "database_task", ref = "../apiexamples/database_task_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "database_task", ref = "../apiexamples/database_task_json") }) }) + @ExampleObject(name = "database_task", ref = "../apiexamples/database_task_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getDatabaseTask", display = "Get database task", permission = Permissions.DATABASE_TASKS_VIEW) public DatabaseTask getDatabaseTask(@Param("databaseTaskId") @Parameter(description = "The ID of the database task.", required = true) @PathParam("databaseTaskId") String databaseTaskId) throws ClientException; diff --git a/server/src/com/mirth/connect/client/core/api/servlets/EngineServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/EngineServletInterface.java index ca5306552c..0de5bacbcb 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/EngineServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/EngineServletInterface.java @@ -22,6 +22,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -36,8 +37,8 @@ @Path("/channels") @Tag(name = "Channel Deployment Operations") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface EngineServletInterface extends BaseServletInterface { @POST @@ -70,7 +71,8 @@ public void deployChannels(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }) }) + @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("returnErrors") @Parameter(description = "If true, an error response code and the exception will be returned.") @QueryParam("returnErrors") boolean returnErrors) throws ClientException; // @formatter:on @@ -94,7 +96,8 @@ public void undeployChannels(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }) }) + @ExampleObject(name = "channel_set", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("returnErrors") @Parameter(description = "If true, an error response code and the exception will be returned.") @QueryParam("returnErrors") boolean returnErrors) throws ClientException; // @formatter:on diff --git a/server/src/com/mirth/connect/client/core/api/servlets/EventServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/EventServletInterface.java index 361b9ad5df..3e4c40941b 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/EventServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/EventServletInterface.java @@ -33,6 +33,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -43,41 +44,46 @@ @Path("/events") @Tag(name = "Events") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface EventServletInterface extends BaseServletInterface { @GET @Path("/maxEventId") @Operation(summary = "Returns the maximum event ID currently in the database.") @MirthOperation(name = "getMaxEventId", display = "Get max event ID", permission = Permissions.EVENTS_VIEW, auditable = false) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) public Integer getMaxEventId() throws ClientException; @GET @Path("/{eventId}") @Operation(summary = "Retrieves an event by ID.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverEvent", ref = "../apiexamples/server_event_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverEvent", ref = "../apiexamples/server_event_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverEvent", ref = "../apiexamples/server_event_json") }) }) + @ExampleObject(name = "serverEvent", ref = "../apiexamples/server_event_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getEvent", display = "Get event by ID", permission = Permissions.EVENTS_VIEW, auditable = false, abortable = true) public ServerEvent getEvent(@Param("eventId") @Parameter(description = "The ID of the event.", required = true) @PathParam("eventId") Integer eventId) throws ClientException; @POST @Path("/_search") @Operation(summary = "Search for events by specific filter criteria.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_json") }) }) + @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getEvents", display = "Get events", permission = Permissions.EVENTS_VIEW, auditable = false, abortable = true) public List getEvents(// @formatter:off @Param("filter") @RequestBody(description = "The EventFilter object to use to query events by.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_json") }) }) EventFilter filter, + @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) EventFilter filter, @Param("offset") @Parameter(description = "Used for pagination, determines where to start in the search results.", schema = @Schema(defaultValue = "0")) @QueryParam("offset") Integer offset, @Param("limit") @Parameter(description = "Used for pagination, determines the maximum number of results to return.", schema = @Schema(defaultValue = "20")) @QueryParam("limit") Integer limit) throws ClientException; // @formatter:on @@ -85,10 +91,12 @@ public List getEvents(// @formatter:off @GET @Path("/") @Operation(summary = "Search for events by specific filter criteria.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_json") }) }) + @ExampleObject(name = "serverEventList", ref = "../apiexamples/server_event_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getEvents", display = "Get events", permission = Permissions.EVENTS_VIEW, auditable = false, abortable = true) public List getEvents(// @formatter:off @Param("maxEventId") @Parameter(description = "The maximum event ID to query.") @QueryParam("maxEventId") Integer maxEventId, @@ -110,18 +118,19 @@ public List getEvents(// @formatter:off @Path("/count/_search") @Operation(summary = "Count number for events by specific filter criteria.") @MirthOperation(name = "getEventCount", display = "Get events results count", permission = Permissions.EVENTS_VIEW, auditable = false, abortable = true) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) public Long getEventCount(@Param("filter") @RequestBody(description = "The EventFilter object to use to query events by.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_json") }) }) EventFilter filter) throws ClientException; + @ExampleObject(name = "filter", ref = "../apiexamples/event_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) EventFilter filter) throws ClientException; @GET @Path("/count") @Operation(summary = "Count number for events by specific filter criteria.") @MirthOperation(name = "getEventCount", display = "Get events results count", permission = Permissions.EVENTS_VIEW, auditable = false, abortable = true) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN }) public Long getEventCount(// @formatter:off @Param("maxEventId") @Parameter(description = "The maximum event ID to query.") @QueryParam("maxEventId") Integer maxEventId, @Param("minEventId") @Parameter(description = "The minimum event ID to query.") @QueryParam("minEventId") Integer minEventId, diff --git a/server/src/com/mirth/connect/client/core/api/servlets/ExtensionServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/ExtensionServletInterface.java index 6945b1297e..6094430f7e 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/ExtensionServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/ExtensionServletInterface.java @@ -37,6 +37,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -46,8 +47,8 @@ @Path("/extensions") @Tag(name = "Extensions") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ExtensionServletInterface extends BaseServletInterface { // These are statically declared because extensions can choose to include them in specific permission groups. @@ -69,25 +70,30 @@ public void uninstallExtension(@Param("extensionPath") @RequestBody(description @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "extensionPath", value = "/path/to/extension") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "extensionPath", value = "/path/to/extension") }) }) String extensionPath) throws ClientException; + @ExampleObject(name = "extensionPath", value = "/path/to/extension") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) String extensionPath) throws ClientException; @GET @Path("/{extensionName}") @Operation(summary = "Returns extension metadata by name.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "metadata", ref = "../apiexamples/connector_metadata_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "metadata", ref = "../apiexamples/connector_metadata_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "metadata", ref = "../apiexamples/connector_metadata_json") }) }) + @ExampleObject(name = "metadata", ref = "../apiexamples/connector_metadata_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getMetaDataByName", display = "Get extension metadata by name", auditable = false) public MetaData getExtensionMetaData(@Param("extensionName") @Parameter(description = "The name of the extension to retrieve.", required = true) @PathParam("extensionName") String extensionName) throws ClientException; @GET @Path("/connectors") @Operation(summary = "Returns all active connector metadata.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connectorMetaDataMap", ref = "../apiexamples/connector_metadata_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connectorMetaDataMap", ref = "../apiexamples/connector_metadata_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connectorMetaDataMap", ref = "../apiexamples/connector_metadata_map_json") }) }) + @ExampleObject(name = "connectorMetaDataMap", ref = "../apiexamples/connector_metadata_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getConnectorMetaData", display = "Get connector metadata", auditable = false) public Map getConnectorMetaData() throws ClientException; @@ -95,19 +101,23 @@ public void uninstallExtension(@Param("extensionPath") @RequestBody(description @Path("/plugins") @Operation(summary = "Returns all active plugin metadata.") @MirthOperation(name = "getPluginMetaData", display = "Get plugin metadata", auditable = false) - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "pluginMetaData", ref = "../apiexamples/plugin_metadata_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "pluginMetaData", ref = "../apiexamples/plugin_metadata_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "pluginMetaData", ref = "../apiexamples/plugin_metadata_map_json") }) }) + @ExampleObject(name = "pluginMetaData", ref = "../apiexamples/plugin_metadata_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) public Map getPluginMetaData() throws ClientException; @GET @Path("/{extensionName}/enabled") @Operation(summary = "Returns the enabled status of an extension.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "extensionEnabled", ref = "../apiexamples/boolean_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "extensionEnabled", ref = "../apiexamples/boolean_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "extensionEnabled", ref = "../apiexamples/boolean_json") }) }) + @ExampleObject(name = "extensionEnabled", ref = "../apiexamples/boolean_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "isExtensionEnabled", display = "Check if extension is enabled", auditable = false) public boolean isExtensionEnabled(@Param("extensionName") @Parameter(description = "The name of the extension to retrieve.", required = true) @PathParam("extensionName") String extensionName) throws ClientException; @@ -123,10 +133,12 @@ public void setExtensionEnabled(// @formatter:off @GET @Path("/{extensionName}/properties") @Operation(summary = "Returns filtered properties for a specified extension.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }) }) + @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = OPERATION_PLUGIN_PROPERTIES_GET, display = "Get filtered plugin properties", auditable = false) public Properties getPluginProperties(// @formatter:off @Param("extensionName") @Parameter(description = "The name of the extension to retrieve.", required = true) @PathParam("extensionName") String extensionName, @@ -141,5 +153,6 @@ public void setPluginProperties(@Param("extensionName") @RequestBody(description @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Properties.class), examples = { @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Properties.class), examples = { - @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }) }) Properties properties, @Param("mergeProperties") @Parameter(description = "Merge or replace properties. Defaults to replace.", required = false, schema = @Schema(defaultValue = "false")) @QueryParam("mergeProperties") boolean mergeProperties) throws ClientException; + @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Properties properties, @Param("mergeProperties") @Parameter(description = "Merge or replace properties. Defaults to replace.", required = false, schema = @Schema(defaultValue = "false")) @QueryParam("mergeProperties") boolean mergeProperties) throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/servlets/MessageServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/MessageServletInterface.java index 4879f0c600..d9eedf99ff 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/MessageServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/MessageServletInterface.java @@ -38,6 +38,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -55,8 +56,8 @@ @Path("/channels") @Tag(name = "Messages") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface MessageServletInterface extends BaseServletInterface { @POST @@ -67,7 +68,8 @@ public interface MessageServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "long", ref = "../apiexamples/long_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "long", ref = "../apiexamples/long_json") }) }) + @ExampleObject(name = "long", ref = "../apiexamples/long_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "processMessages", display = "Process messages", permission = Permissions.MESSAGES_PROCESS, type = ExecuteType.ASYNC) public Long processMessage(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -86,7 +88,8 @@ public Long processMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "long", ref = "../apiexamples/long_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "long", ref = "../apiexamples/long_json") }) }) + @ExampleObject(name = "long", ref = "../apiexamples/long_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "processMessages", display = "Process messages", permission = Permissions.MESSAGES_PROCESS, type = ExecuteType.ASYNC) public Long processMessage(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -94,7 +97,8 @@ public Long processMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "rawMessage", ref = "../apiexamples/raw_message_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "rawMessage", ref = "../apiexamples/raw_message_json") }) }) RawMessage rawMessage) throws ClientException; + @ExampleObject(name = "rawMessage", ref = "../apiexamples/raw_message_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) RawMessage rawMessage) throws ClientException; // @formatter:on @GET @@ -104,7 +108,8 @@ public Long processMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "message", ref = "../apiexamples/message_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "message", ref = "../apiexamples/message_json") }) }) + @ExampleObject(name = "message", ref = "../apiexamples/message_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getMessageContent", display = "Get message content", permission = Permissions.MESSAGES_VIEW, type = ExecuteType.ASYNC) public Message getMessageContent(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -115,10 +120,12 @@ public Message getMessageContent(// @formatter:off @GET @Path("/{channelId}/messages/{messageId}/attachments") @Operation(summary = "Retrieve a list of attachments by message ID.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "attachmentList", ref = "../apiexamples/attachment_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "attachmentList", ref = "../apiexamples/attachment_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "attachmentList", ref = "../apiexamples/attachment_list_json") }) }) + @ExampleObject(name = "attachmentList", ref = "../apiexamples/attachment_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAttachmentsByMessageId", display = "Get attachments by message ID", permission = Permissions.MESSAGES_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getAttachmentsByMessageId(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -133,7 +140,8 @@ public List getAttachmentsByMessageId(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "attachment", ref = "../apiexamples/attachment_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "attachment", ref = "../apiexamples/attachment_json") }) }) + @ExampleObject(name = "attachment", ref = "../apiexamples/attachment_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAttachment", display = "Get attachment", permission = Permissions.MESSAGES_VIEW, type = ExecuteType.ASYNC) public Attachment getAttachment(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -153,7 +161,8 @@ public String getDICOMMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "connectorMessage", ref = "../apiexamples/connector_message_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connectorMessage", ref = "../apiexamples/connector_message_json") }) }) ConnectorMessage message) throws ClientException; + @ExampleObject(name = "connectorMessage", ref = "../apiexamples/connector_message_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) ConnectorMessage message) throws ClientException; // @formatter:on @GET @@ -163,7 +172,8 @@ public String getDICOMMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messageId", ref = "../apiexamples/long_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messageId", ref = "../apiexamples/long_json") }) }) + @ExampleObject(name = "messageId", ref = "../apiexamples/long_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getMaxMessageId", display = "Get max messageId", permission = Permissions.MESSAGES_VIEW, type = ExecuteType.ASYNC, auditable = false) public Long getMaxMessageId(@Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId) throws ClientException; @@ -174,7 +184,8 @@ public String getDICOMMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messages", ref = "../apiexamples/message_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messages", ref = "../apiexamples/message_list_json") }) }) + @ExampleObject(name = "messages", ref = "../apiexamples/message_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "searchMessages", display = "Get messages by page limit", permission = Permissions.MESSAGES_VIEW, abortable = true) public List getMessages(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -182,7 +193,8 @@ public List getMessages(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }) }) MessageFilter filter, + @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) MessageFilter filter, @Param("includeContent") @Parameter(description = "If true, message content will be returned with the results.", schema = @Schema(defaultValue = "false")) @QueryParam("includeContent") Boolean includeContent, @Param("offset") @Parameter(description = "Used for pagination, determines where to start in the search results.", schema = @Schema(defaultValue = "0")) @QueryParam("offset") Integer offset, @Param("limit") @Parameter(description = "Used for pagination, determines the maximum number of results to return.", schema = @Schema(defaultValue = "20")) @QueryParam("limit") Integer limit) throws ClientException; @@ -195,7 +207,8 @@ public List getMessages(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messages", ref = "../apiexamples/message_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messages", ref = "../apiexamples/message_list_json") }) }) + @ExampleObject(name = "messages", ref = "../apiexamples/message_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "searchMessages", display = "Get messages by page limit", permission = Permissions.MESSAGES_VIEW, abortable = true) public List getMessages(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -247,7 +260,8 @@ public List getMessages(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messageCount", ref = "../apiexamples/long_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messageCount", ref = "../apiexamples/long_json") }) }) + @ExampleObject(name = "messageCount", ref = "../apiexamples/long_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getSearchCount", display = "Get search results count", permission = Permissions.MESSAGES_VIEW, abortable = true) public Long getMessageCount(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -255,7 +269,8 @@ public Long getMessageCount(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }) }) MessageFilter filter) throws ClientException; + @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) MessageFilter filter) throws ClientException; // @formatter:off @GET @@ -265,7 +280,8 @@ public Long getMessageCount(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messageCount", ref = "../apiexamples/long_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messageCount", ref = "../apiexamples/long_json") }) }) + @ExampleObject(name = "messageCount", ref = "../apiexamples/long_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getSearchCount", display = "Get search results count", permission = Permissions.MESSAGES_VIEW, abortable = true) public Long getMessageCount(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, @@ -317,7 +333,8 @@ public void reprocessMessages(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }) }) MessageFilter filter, + @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) MessageFilter filter, @Param("replace") @Parameter(description = "If true, the message will overwrite the current one", schema = @Schema(defaultValue = "false")) @QueryParam("replace") boolean replace, @Param("filterDestinations") @Parameter(description = "If true, the metaDataId parameter will be used to determine which destinations to reprocess the message through.", schema = @Schema(defaultValue = "false")) @QueryParam("filterDestinations") boolean filterDestinations, @Param("reprocessMetaDataIds") @Parameter(description = "Indicates which destinations to send the message to.") @QueryParam("metaDataId") Set reprocessMetaDataIds) throws ClientException; @@ -393,7 +410,8 @@ public void removeMessages(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }) }) MessageFilter filter) throws ClientException; + @ExampleObject(name = "filter", ref = "../apiexamples/message_filter_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) MessageFilter filter) throws ClientException; // @formatter:on @DELETE @@ -481,7 +499,8 @@ public void removeAllMessagesPost(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }) }) Set channelIds, + @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("restartRunningChannels") @Parameter(description = "If true, currently running channels will be stopped and restarted as part of the remove process. Otherwise, currently running channels will not be included.", schema = @Schema(defaultValue = "false")) @QueryParam("restartRunningChannels") boolean restartRunningChannels, @Param("clearStatistics") @Parameter(description = "If true, message statistics will also be cleared.", schema = @Schema(defaultValue = "true")) @QueryParam("clearStatistics") boolean clearStatistics) throws ClientException; // @formatter:on @@ -496,7 +515,8 @@ public void importMessage(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "message", ref = "../apiexamples/message_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "message", ref = "../apiexamples/message_json") }) }) Message message) throws ClientException; + @ExampleObject(name = "message", ref = "../apiexamples/message_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Message message) throws ClientException; // @formatter:on @POST @@ -506,7 +526,8 @@ public void importMessage(// @formatter:off @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "messageImportResult", ref = "../apiexamples/message_import_result_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "messageImportResult", ref = "../apiexamples/message_import_result_json") }) }) + @ExampleObject(name = "messageImportResult", ref = "../apiexamples/message_import_result_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "importMessageServer", display = "Import messages on the server", permission = Permissions.MESSAGES_IMPORT, type = ExecuteType.ASYNC) public MessageImportResult importMessagesServer(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @PathParam("channelId") String channelId, diff --git a/server/src/com/mirth/connect/client/core/api/servlets/SystemServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/SystemServletInterface.java index f0a2de4fc8..d0ff085613 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/SystemServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/SystemServletInterface.java @@ -23,6 +23,7 @@ import javax.ws.rs.core.MediaType; import com.mirth.connect.client.core.ClientException; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.model.SystemInfo; @@ -30,8 +31,8 @@ @Path("/system") @Tag(name = "System Information and Statistics") -@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) -@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) +@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON}) +@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON}) public interface SystemServletInterface extends BaseServletInterface { @GET @Path("/info") @@ -40,7 +41,8 @@ public interface SystemServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "systemInfo", ref = "../apiexamples/system_info_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "systemInfo", ref = "../apiexamples/system_info_json") }) }) + @ExampleObject(name = "systemInfo", ref = "../apiexamples/system_info_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getJVMInfo", display = "Get System Information", auditable = false) public SystemInfo getInfo() throws ClientException; @@ -51,7 +53,8 @@ public interface SystemServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "systemStats", ref = "../apiexamples/system_stats_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "systemStats", ref = "../apiexamples/system_stats_json") }) }) + @ExampleObject(name = "systemStats", ref = "../apiexamples/system_stats_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getStats", display = "Get System Statistics", auditable = false) public SystemStats getStats() throws ClientException; } diff --git a/server/src/com/mirth/connect/client/core/api/servlets/UsageServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/UsageServletInterface.java index 3db8220b00..a46b15cd91 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/UsageServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/UsageServletInterface.java @@ -26,28 +26,32 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/usageData") @Tag(name = "Usage Data") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface UsageServletInterface extends BaseServletInterface { @POST @Path("/_generate") @Produces(MediaType.TEXT_PLAIN) @Operation(summary = "Generates usage document using data from both the client and server.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "purgedDocument", ref = "../apiexamples/purged_document_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "purgedDocument", ref = "../apiexamples/purged_document_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "purgedDocument", ref = "../apiexamples/purged_document_json") }) }) + @ExampleObject(name = "purgedDocument", ref = "../apiexamples/purged_document_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getUsageData", display = "Get usage data", type = ExecuteType.ASYNC, auditable = false) public String getUsageData(@Param("clientStats") @RequestBody(description = "The map of client usage data to use.", required = true, content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "clientStats", ref = "../apiexamples/generic_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "clientStats", ref = "../apiexamples/generic_map_json") }) }) Map clientStats) throws ClientException; + @ExampleObject(name = "clientStats", ref = "../apiexamples/generic_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Map clientStats) throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/client/core/api/servlets/UserServletInterface.java b/server/src/com/mirth/connect/client/core/api/servlets/UserServletInterface.java index 906c9f4647..b1d86a901a 100644 --- a/server/src/com/mirth/connect/client/core/api/servlets/UserServletInterface.java +++ b/server/src/com/mirth/connect/client/core/api/servlets/UserServletInterface.java @@ -37,6 +37,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; import com.mirth.connect.client.core.Permissions; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -45,8 +46,8 @@ @Path("/users") @Tag(name = "Users") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface UserServletInterface extends BaseServletInterface { public static final String LOGIN_SERVER_URL_HEADER = "X-Mirth-Server-Url"; @@ -56,10 +57,13 @@ public interface UserServletInterface extends BaseServletInterface { @Path("/_login") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Operation(summary = "Logs in to the server using the specified name and password.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "loginStatus", ref = "../apiexamples/login_status_xml") }), - @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "loginStatus", ref = "../apiexamples/login_status_json") }) }) + @Content(mediaType = MediaType.APPLICATION_JSON, examples = { + @ExampleObject(name = "loginStatus", ref = "../apiexamples/login_status_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON) + }) @MirthOperation(name = "login", display = "Login") public LoginStatus login(// @formatter:off @Param("username") @Parameter(description = "The username to login with.", required = true, schema = @Schema(defaultValue = "admin")) @FormParam("username") String username, @@ -86,7 +90,8 @@ public void createUser(@Param("user") @RequestBody(description = "The User objec @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "user", ref = "../apiexamples/new_user_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "user", ref = "../apiexamples/new_user_json") }) }) User user) throws ClientException; + @ExampleObject(name = "user", ref = "../apiexamples/new_user_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) User user) throws ClientException; @GET @Path("/") @@ -95,7 +100,8 @@ public void createUser(@Param("user") @RequestBody(description = "The User objec @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "allUsers", ref = "../apiexamples/user_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "allUsers", ref = "../apiexamples/user_list_json") }) }) + @ExampleObject(name = "allUsers", ref = "../apiexamples/user_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAllUsers", display = "Get all users", permission = Permissions.USERS_MANAGE, type = ExecuteType.ASYNC, auditable = false) public List getAllUsers() throws ClientException; @@ -106,7 +112,8 @@ public void createUser(@Param("user") @RequestBody(description = "The User objec @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "user", ref = "../apiexamples/user_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "user", ref = "../apiexamples/user_json") }) }) + @ExampleObject(name = "user", ref = "../apiexamples/user_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getUser", display = "Get user", permission = Permissions.USERS_MANAGE, type = ExecuteType.ASYNC, auditable = false) public User getUser(@Param("userIdOrName") @Parameter(description = "The unique ID or username of the user to retrieve.", required = true) @PathParam("userIdOrName") String userIdOrName) throws ClientException; @@ -117,7 +124,8 @@ public void createUser(@Param("user") @RequestBody(description = "The User objec @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "user", ref = "../apiexamples/user_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "user", ref = "../apiexamples/user_json") }) }) + @ExampleObject(name = "user", ref = "../apiexamples/user_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getCurrentUser", display = "Get current user", auditable = false) public User getCurrentUser() throws ClientException; @@ -131,7 +139,8 @@ public void updateUser(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "user", ref = "../apiexamples/user_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "user", ref = "../apiexamples/user_json") }) }) User user) throws ClientException; + @ExampleObject(name = "user", ref = "../apiexamples/user_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) User user) throws ClientException; // @formatter:on @POST @@ -141,7 +150,8 @@ public void updateUser(// @formatter:off @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_json") }) }) + @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "checkUserPassword", display = "Check a password against requirements.", permission = Permissions.USERS_MANAGE) public List checkUserPassword(@Param(value = "plainPassword", excludeFromAudit = true) @Parameter(description = "The plaintext password to check.", required = true) String plainPassword) throws ClientException; @@ -149,10 +159,12 @@ public void updateUser(// @formatter:off @Path("/{userId}/password") @Consumes(MediaType.TEXT_PLAIN) @Operation(summary = "Updates a user's password.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_json") }) }) + @ExampleObject(name = "passwordRequirementList", ref = "../apiexamples/password_requirement_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "updateUserPassword", display = "Update a user's password", permission = Permissions.USERS_MANAGE) public List updateUserPassword(// @formatter:off @Param("userId") @Parameter(description = "The unique ID of the user to update the password for.", required = true) @PathParam("userId") Integer userId, @@ -172,7 +184,8 @@ public List updateUserPassword(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "loggedIn", ref = "../apiexamples/boolean_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "loggedIn", ref = "../apiexamples/boolean_json") }) }) + @ExampleObject(name = "loggedIn", ref = "../apiexamples/boolean_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "isUserLoggedIn", display = "Check if user is logged in", permission = Permissions.USERS_MANAGE) public boolean isUserLoggedIn(@Param("userId") @Parameter(description = "The unique ID of the user.", required = true) @PathParam("userId") Integer userId) throws ClientException; @@ -184,7 +197,8 @@ public List updateUserPassword(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Properties.class), examples = { @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Properties.class), examples = { - @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }) }) + @ExampleObject(name = "propertiesObject", ref = "../apiexamples/properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) public Properties getUserPreferences(// @formatter:off @Param("userId") @Parameter(description = "The unique ID of the user.", required = true) @PathParam("userId") Integer userId, @Param("names") @Parameter(description = "An optional set of property names to filter by.") @QueryParam("name") Set names) throws ClientException; @@ -210,7 +224,8 @@ public void setUserPreferences(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(implementation = Properties.class), examples = { @ExampleObject(name = "properties", ref = "../apiexamples/properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Properties.class), examples = { - @ExampleObject(name = "properties", ref = "../apiexamples/properties_json") }) }) Properties properties) + @ExampleObject(name = "properties", ref = "../apiexamples/properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Properties properties) throws ClientException; // @formatter:on diff --git a/server/src/com/mirth/connect/connectors/doc/DocumentConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/doc/DocumentConnectorServletInterface.java index 1a45942aaa..0b64fda69b 100644 --- a/server/src/com/mirth/connect/connectors/doc/DocumentConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/doc/DocumentConnectorServletInterface.java @@ -26,6 +26,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -33,8 +34,8 @@ @Path("/connectors/doc") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DocumentConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Document Connector Service"; @@ -43,10 +44,12 @@ public interface DocumentConnectorServletInterface extends BaseServletInterface @Path("/_testWrite") @Consumes(MediaType.TEXT_PLAIN) @Operation(summary = "Tests whether a file can be written to the specified directory.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }) }) + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testWrite", display = "Test Write", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testWrite(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, diff --git a/server/src/com/mirth/connect/connectors/file/FileConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/file/FileConnectorServletInterface.java index 51531f8ccf..7a9dd73a2f 100644 --- a/server/src/com/mirth/connect/connectors/file/FileConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/file/FileConnectorServletInterface.java @@ -26,6 +26,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -33,8 +34,8 @@ @Path("/connectors/file") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface FileConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "File Connector Service"; @@ -42,10 +43,12 @@ public interface FileConnectorServletInterface extends BaseServletInterface { @POST @Path("/_testRead") @Operation(summary = "Tests whether a file can be read from the specified directory.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }) }) + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testRead", display = "Test Read", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testRead(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -55,17 +58,20 @@ public ConnectionTestResponse testRead(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "file_receiver_properties", ref = "../apiexamples/file_receiver_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "file_receiver_properties", ref = "../apiexamples/file_receiver_properties_json") }) }) + @ExampleObject(name = "file_receiver_properties", ref = "../apiexamples/file_receiver_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) FileReceiverProperties properties) throws ClientException; // @formatter:on @POST @Path("/_testWrite") @Operation(summary = "Tests whether a file can be written to the specified directory.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }) }) + @ExampleObject(name = "connection_test_response_file", ref = "../apiexamples/connection_test_response_file_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testWrite", display = "Test Write", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testWrite(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -75,7 +81,8 @@ public ConnectionTestResponse testWrite(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "file_dispatcher_properties", ref = "../apiexamples/file_dispatcher_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "file_dispatcher_properties", ref = "../apiexamples/file_dispatcher_properties_json") }) }) + @ExampleObject(name = "file_dispatcher_properties", ref = "../apiexamples/file_dispatcher_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) FileDispatcherProperties properties) throws ClientException; // @formatter:on } \ No newline at end of file diff --git a/server/src/com/mirth/connect/connectors/http/HttpConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/http/HttpConnectorServletInterface.java index 8d5751cdb1..4c7b01db9f 100644 --- a/server/src/com/mirth/connect/connectors/http/HttpConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/http/HttpConnectorServletInterface.java @@ -26,6 +26,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -33,8 +34,8 @@ @Path("/connectors/http") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface HttpConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "HTTP Connector Service"; @@ -42,10 +43,12 @@ public interface HttpConnectorServletInterface extends BaseServletInterface { @POST @Path("/_testConnection") @Operation(summary = "Tests whether a connection can be successfully established to the destination endpoint.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_http", ref = "../apiexamples/connection_test_response_http_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_http", ref = "../apiexamples/connection_test_response_http_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_http", ref = "../apiexamples/connection_test_response_http_json") }) }) + @ExampleObject(name = "connection_test_response_http", ref = "../apiexamples/connection_test_response_http_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testConnection", display = "Test HTTP Connection", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testConnection(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -55,7 +58,8 @@ public ConnectionTestResponse testConnection(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "http_dispatcher_properties", ref = "../apiexamples/http_dispatcher_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "http_dispatcher_properties", ref = "../apiexamples/http_dispatcher_properties_json") }) }) + @ExampleObject(name = "http_dispatcher_properties", ref = "../apiexamples/http_dispatcher_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) HttpDispatcherProperties properties) throws ClientException; // @formatter:on } \ No newline at end of file diff --git a/server/src/com/mirth/connect/connectors/jdbc/DatabaseConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/jdbc/DatabaseConnectorServletInterface.java index 40ae6174fb..952afc1ae4 100644 --- a/server/src/com/mirth/connect/connectors/jdbc/DatabaseConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/jdbc/DatabaseConnectorServletInterface.java @@ -30,14 +30,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/connectors/jdbc") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DatabaseConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Database Connector Service"; @@ -49,7 +50,8 @@ public interface DatabaseConnectorServletInterface extends BaseServletInterface @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "table_set", ref = "../apiexamples/table_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "table_set", ref = "../apiexamples/table_set_json") }) }) + @ExampleObject(name = "table_set", ref = "../apiexamples/table_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getTables", display = "Get Tables", type = ExecuteType.ASYNC, auditable = false) public SortedSet getTables(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, diff --git a/server/src/com/mirth/connect/connectors/jms/JmsConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/jms/JmsConnectorServletInterface.java index e346db5abe..0ba07a80d4 100644 --- a/server/src/com/mirth/connect/connectors/jms/JmsConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/jms/JmsConnectorServletInterface.java @@ -32,14 +32,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/connectors/jms") @Tag(name = "Connector Services") -@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) -@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) +@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON}) +@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON}) public interface JmsConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "JMS Connector Service"; @@ -51,7 +52,8 @@ public interface JmsConnectorServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "jms_connector_properties_map", ref = "../apiexamples/jms_connector_properties_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "jms_connector_properties_map", ref = "../apiexamples/jms_connector_properties_map_json") }) }) + @ExampleObject(name = "jms_connector_properties_map", ref = "../apiexamples/jms_connector_properties_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getTemplates", display = "Get JMS Templates", type = ExecuteType.ASYNC, auditable = false) public LinkedHashMap getTemplates() throws ClientException; @@ -62,7 +64,8 @@ public interface JmsConnectorServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_json") }) }) + @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getTemplate", display = "Get JMS Template", type = ExecuteType.ASYNC, auditable = false) public JmsConnectorProperties getTemplate(@Param("templateName") @Parameter(description = "The name of the template.", required = true) @PathParam("templateName") String templateName) throws ClientException; @@ -73,7 +76,8 @@ public interface JmsConnectorServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_json") }) }) + @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "saveTemplate", display = "Save JMS Template", type = ExecuteType.ASYNC, auditable = false) public Set saveTemplate(// @formatter:off @Param("templateName") @Parameter(description = "The name of the template.", required = true) @PathParam("templateName") String templateName, @@ -82,7 +86,8 @@ public Set saveTemplate(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_json") }) }) + @ExampleObject(name = "jms_connector_properties", ref = "../apiexamples/jms_connector_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) JmsConnectorProperties properties) throws ClientException; // @formatter:on @@ -93,7 +98,8 @@ public Set saveTemplate(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_json") }) }) + @ExampleObject(name = "jms_template_name_set", ref = "../apiexamples/jms_template_name_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "saveTemplate", display = "Save JMS Template", type = ExecuteType.ASYNC, auditable = false) public Set deleteTemplate(@Param("templateName") @Parameter(description = "The name of the template.", required = true) @PathParam("templateName") String templateName) throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/connectors/smtp/SmtpConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/smtp/SmtpConnectorServletInterface.java index 1d55bc6c95..cf2335786a 100644 --- a/server/src/com/mirth/connect/connectors/smtp/SmtpConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/smtp/SmtpConnectorServletInterface.java @@ -26,6 +26,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -33,8 +34,8 @@ @Path("/connectors/smtp") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface SmtpConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "SMTP Connector Service"; @@ -42,10 +43,12 @@ public interface SmtpConnectorServletInterface extends BaseServletInterface { @POST @Path("/_sendTestEmail") @Operation(summary = "Sends a test e-mail, replacing any connector properties first.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_smtp", ref = "../apiexamples/connection_test_response_smtp_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_smtp", ref = "../apiexamples/connection_test_response_smtp_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_smtp", ref = "../apiexamples/connection_test_response_smtp_json") }) }) + @ExampleObject(name = "connection_test_response_smtp", ref = "../apiexamples/connection_test_response_smtp_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "sendTestEmail", display = "Send Test Email", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse sendTestEmail(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -59,7 +62,8 @@ public ConnectionTestResponse sendTestEmail(// @formatter:off @Content(mediaType = MediaType.APPLICATION_JSON, examples = { @ExampleObject(name = "smtp_dispatcher_properties", ref = "../apiexamples/smtp_dispatcher_properties_json"), @ExampleObject(name = "smtp_dispatcher_properties_ssl", ref = "../apiexamples/smtp_dispatcher_properties_ssl_json"), - @ExampleObject(name = "smtp_dispatcher_properties_tls", ref = "../apiexamples/smtp_dispatcher_properties_tls_json") }) }) + @ExampleObject(name = "smtp_dispatcher_properties_tls", ref = "../apiexamples/smtp_dispatcher_properties_tls_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) SmtpDispatcherProperties properties) throws ClientException; // @formatter:on } \ No newline at end of file diff --git a/server/src/com/mirth/connect/connectors/tcp/TcpConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/tcp/TcpConnectorServletInterface.java index 01c2341e17..5aba873184 100644 --- a/server/src/com/mirth/connect/connectors/tcp/TcpConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/tcp/TcpConnectorServletInterface.java @@ -26,6 +26,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -33,8 +34,8 @@ @Path("/connectors/tcp") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface TcpConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "HTTP Connector Service"; @@ -42,10 +43,12 @@ public interface TcpConnectorServletInterface extends BaseServletInterface { @POST @Path("/_testConnection") @Operation(summary = "Tests whether a connection can be successfully established to the destination endpoint.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_tcp", ref = "../apiexamples/connection_test_response_tcp_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_tcp", ref = "../apiexamples/connection_test_response_tcp_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_tcp", ref = "../apiexamples/connection_test_response_tcp_json") }) }) + @ExampleObject(name = "connection_test_response_tcp", ref = "../apiexamples/connection_test_response_tcp_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testConnection", display = "Test TCP Connection", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testConnection(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -55,7 +58,8 @@ public ConnectionTestResponse testConnection(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "tcp_dispatcher_properties", ref = "../apiexamples/tcp_dispatcher_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "tcp_dispatcher_properties", ref = "../apiexamples/tcp_dispatcher_properties_json") }) }) + @ExampleObject(name = "tcp_dispatcher_properties", ref = "../apiexamples/tcp_dispatcher_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) TcpDispatcherProperties properties) throws ClientException; // @formatter:on } \ No newline at end of file diff --git a/server/src/com/mirth/connect/connectors/ws/WebServiceConnectorServletInterface.java b/server/src/com/mirth/connect/connectors/ws/WebServiceConnectorServletInterface.java index bd0d63e9ab..f257f910d9 100644 --- a/server/src/com/mirth/connect/connectors/ws/WebServiceConnectorServletInterface.java +++ b/server/src/com/mirth/connect/connectors/ws/WebServiceConnectorServletInterface.java @@ -28,6 +28,7 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @@ -35,8 +36,8 @@ @Path("/connectors/ws") @Tag(name = "Connector Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface WebServiceConnectorServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Web Service Connector Service"; @@ -44,10 +45,12 @@ public interface WebServiceConnectorServletInterface extends BaseServletInterfac @POST @Path("/_cacheWsdlFromUrl") @Operation(summary = "Downloads the WSDL at the specified URL and caches the web service definition tree.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "cache_wsdl_from_url", ref = "../apiexamples/null_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "cache_wsdl_from_url", ref = "../apiexamples/null_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "cache_wsdl_from_url", ref = "../apiexamples/null_json") }) }) + @ExampleObject(name = "cache_wsdl_from_url", ref = "../apiexamples/null_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "cacheWsdlFromUrl", display = "Download and cache WSDL", type = ExecuteType.ASYNC, auditable = false) public Object cacheWsdlFromUrl(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -57,7 +60,8 @@ public Object cacheWsdlFromUrl(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_json") }) }) + @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) WebServiceDispatcherProperties properties) throws ClientException; // @formatter:on @@ -69,7 +73,8 @@ public Object cacheWsdlFromUrl(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "is_wsdl_cached", ref = "../apiexamples/boolean_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "is_wsdl_cached", ref = "../apiexamples/boolean_json") }) }) + @ExampleObject(name = "is_wsdl_cached", ref = "../apiexamples/boolean_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "isWsdlCached", display = "Check if WSDL is cached", type = ExecuteType.ASYNC, auditable = false) public boolean isWsdlCached(// @formatter:off @Param("channelId") @@ -97,10 +102,12 @@ public boolean isWsdlCached(// @formatter:off @Path("/_getDefinition") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Operation(summary = "Retrieves the definition service map corresponding to the specified WSDL.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "definition_service_map", ref = "../apiexamples/definition_service_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "definition_service_map", ref = "../apiexamples/definition_service_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "definition_service_map", ref = "../apiexamples/definition_service_map_json") }) }) + @ExampleObject(name = "definition_service_map", ref = "../apiexamples/definition_service_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getDefinition", display = "Get WSDL Definition", type = ExecuteType.ASYNC, auditable = false) public DefinitionServiceMap getDefinition(// @formatter:off @Param("channelId") @@ -216,10 +223,12 @@ public String getSoapAction(// @formatter:off @POST @Path("/_testConnection") @Operation(summary = "Tests whether a connection can be successfully established to the destination endpoint.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connection_test_response_ws", ref = "../apiexamples/connection_test_response_ws_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connection_test_response_ws", ref = "../apiexamples/connection_test_response_ws_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connection_test_response_ws", ref = "../apiexamples/connection_test_response_ws_json") }) }) + @ExampleObject(name = "connection_test_response_ws", ref = "../apiexamples/connection_test_response_ws_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "testConnection", display = "Test Web Service Connection", type = ExecuteType.ASYNC, auditable = false) public ConnectionTestResponse testConnection(// @formatter:off @Param("channelId") @Parameter(description = "The ID of the channel.", required = true) @QueryParam("channelId") String channelId, @@ -229,7 +238,8 @@ public ConnectionTestResponse testConnection(// @formatter:off @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_json") }) }) + @ExampleObject(name = "ws_dispatcher_properties", ref = "../apiexamples/ws_dispatcher_properties_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) WebServiceDispatcherProperties properties) throws ClientException; // @formatter:on } \ No newline at end of file diff --git a/server/src/com/mirth/connect/plugins/dashboardstatus/DashboardConnectorStatusServletInterface.java b/server/src/com/mirth/connect/plugins/dashboardstatus/DashboardConnectorStatusServletInterface.java index fb6344f8ac..739039e7c5 100644 --- a/server/src/com/mirth/connect/plugins/dashboardstatus/DashboardConnectorStatusServletInterface.java +++ b/server/src/com/mirth/connect/plugins/dashboardstatus/DashboardConnectorStatusServletInterface.java @@ -30,14 +30,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/extensions/dashboardstatus") @Tag(name = "Extension Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DashboardConnectorStatusServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Dashboard Connector Status Service"; @@ -46,10 +47,12 @@ public interface DashboardConnectorStatusServletInterface extends BaseServletInt @GET @Path("/connectorStates") @Operation(summary = "Retrieves all dashboard connector states.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboardConnectorStateMap", ref = "../apiexamples/dashboard_connector_state_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboardConnectorStateMap", ref = "../apiexamples/dashboard_connector_state_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboardConnectorStateMap", ref = "../apiexamples/dashboard_connector_state_map_json") }) }) + @ExampleObject(name = "dashboardConnectorStateMap", ref = "../apiexamples/dashboard_connector_state_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getStates", display = "Get dashboard connector states", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public Map getConnectorStateMap(// @formatter:off @Param("serverId") @Parameter(description = "The server ID to retrieve connector statuses for. Connector Statuses across all servers are retrieved is this parameter is not specified.") @QueryParam("serverId") String serverId @@ -59,10 +62,12 @@ public Map getConnectorStateMap(// @formatter:off @GET @Path("/channelStates") @Operation(summary = "Retrieves all dashboard channel states.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dashboardChannelStateMap", ref = "../apiexamples/dashboard_channel_state_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dashboardChannelStateMap", ref = "../apiexamples/dashboard_channel_state_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dashboardChannelStateMap", ref = "../apiexamples/dashboard_channel_state_map_json") }) }) + @ExampleObject(name = "dashboardChannelStateMap", ref = "../apiexamples/dashboard_channel_state_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getChannelStates", display = "Get dashboard channel states", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public Map getChannelStates() throws ClientException; @@ -76,10 +81,12 @@ public Map getConnectorStateMap(// @formatter:off @GET @Path("/connectionLogs") @Operation(summary = "Retrieves connection logs for all channels.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_json") }) }) + @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getConnectionInfoLogs", display = "Get channel connection logs", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public LinkedList getAllChannelLogs(//@formatter:off @Param("serverId") @Parameter(description = "The server ID to retrieve logs for. Logs for all servers are retrieved is this parameter is not specified.") @QueryParam("serverId") String serverId, @@ -90,10 +97,12 @@ public LinkedList getAllChannelLogs(//@formatter:off @GET @Path("/connectionLogs/{channelId}") @Operation(summary = "Retrieves connection logs for a specific channel.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_json") }) }) + @ExampleObject(name = "connectionLogItemLinkedList", ref = "../apiexamples/connection_log_item_linked_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getConnectionInfoLogs", display = "Get channel connection logs", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public LinkedList getChannelLog(// @formatter:off @Param("serverId") @Parameter(description = "The server ID to retrieve logs for. Logs for all servers are retrieved is this parameter is not specified.") @QueryParam("serverId") String serverId, diff --git a/server/src/com/mirth/connect/plugins/datapruner/DataPrunerServletInterface.java b/server/src/com/mirth/connect/plugins/datapruner/DataPrunerServletInterface.java index 60ba7f4076..297a4f21d9 100644 --- a/server/src/com/mirth/connect/plugins/datapruner/DataPrunerServletInterface.java +++ b/server/src/com/mirth/connect/plugins/datapruner/DataPrunerServletInterface.java @@ -26,13 +26,14 @@ import javax.ws.rs.core.MediaType; import com.mirth.connect.client.core.ClientException; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; @Path("/extensions/datapruner") @Tag(name = "Extension Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DataPrunerServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Data Pruner"; @@ -47,10 +48,12 @@ public interface DataPrunerServletInterface extends BaseServletInterface { @GET @Path("/status") @Operation(summary = "Retrieves the current data pruner status.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "dataPrunerStatusMap", ref = "../apiexamples/data_pruner_status_map_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "dataPrunerStatusMap", ref = "../apiexamples/data_pruner_status_map_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "dataPrunerStatusMap", ref = "../apiexamples/data_pruner_status_map_json") }) }) + @ExampleObject(name = "dataPrunerStatusMap", ref = "../apiexamples/data_pruner_status_map_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getDataPrunerStatusMap", display = "Get status", permission = PERMISSION_VIEW) public Map getStatusMap() throws ClientException; @@ -61,7 +64,8 @@ public interface DataPrunerServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "calendar", ref = "../apiexamples/calendar_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "calendar", ref = "../apiexamples/calendar_json") }) }) + @ExampleObject(name = "calendar", ref = "../apiexamples/calendar_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "startDataPruner", display = "Start pruner", permission = PERMISSION_START_STOP) public Calendar start() throws ClientException; diff --git a/server/src/com/mirth/connect/plugins/directoryresource/DirectoryResourceServletInterface.java b/server/src/com/mirth/connect/plugins/directoryresource/DirectoryResourceServletInterface.java index 27083024b6..857fe9bac0 100644 --- a/server/src/com/mirth/connect/plugins/directoryresource/DirectoryResourceServletInterface.java +++ b/server/src/com/mirth/connect/plugins/directoryresource/DirectoryResourceServletInterface.java @@ -27,14 +27,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/extensions/directoryresource") @Tag(name = "Extension Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface DirectoryResourceServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = DirectoryResourceProperties.PLUGIN_POINT; @@ -42,10 +43,12 @@ public interface DirectoryResourceServletInterface extends BaseServletInterface @GET @Path("/resources/{resourceId}/libraries") @Operation(summary = "Retrieves all library URLs for the given directory resource.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "libraryList", ref = "../apiexamples/library_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "libraryList", ref = "../apiexamples/library_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "libraryList", ref = "../apiexamples/library_list_json") }) }) + @ExampleObject(name = "libraryList", ref = "../apiexamples/library_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getLibraries", display = "Get libraries", type = ExecuteType.ASYNC) public List getLibraries(@Param("resourceId") @Parameter(description = "The ID of the directory resource.", required = true) @PathParam("resourceId") String resourceId) throws ClientException; } \ No newline at end of file diff --git a/server/src/com/mirth/connect/plugins/globalmapviewer/GlobalMapServletInterface.java b/server/src/com/mirth/connect/plugins/globalmapviewer/GlobalMapServletInterface.java index c41fa3f3e0..f26ae0647c 100644 --- a/server/src/com/mirth/connect/plugins/globalmapviewer/GlobalMapServletInterface.java +++ b/server/src/com/mirth/connect/plugins/globalmapviewer/GlobalMapServletInterface.java @@ -31,14 +31,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/extensions/globalmapviewer") @Tag(name = "Extension Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface GlobalMapServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Global Maps"; @@ -51,7 +52,8 @@ public interface GlobalMapServletInterface extends BaseServletInterface { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_json") }) }) + @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAllMaps", display = "Get global / global channel maps", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public Map>> getAllMaps(// @formatter:off @Param("channelIds") @Parameter(description = "The ID of the channel to retrieve global channel map information for.") @QueryParam("channelId") Set channelIds, @@ -65,14 +67,16 @@ public Map>> getAllMaps(// @formatter:of @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_json") }) }) + @ExampleObject(name = "globalMaps", ref = "../apiexamples/global_maps_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getAllMaps", display = "Get global / global channel maps", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public Map>> getAllMapsPost(// @formatter:off @Param("channelIds") @RequestBody(description = "The ID of the channel to retrieve global channel map information for.", content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }) }) Set channelIds, + @ExampleObject(name = "channelIds", ref = "../apiexamples/guid_set_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set channelIds, @Param("includeGlobalMap") @Parameter(description = "If true, the global map will be returned.") @QueryParam("includeGlobalMap") boolean includeGlobalMap) throws ClientException; // @formatter:on diff --git a/server/src/com/mirth/connect/plugins/serverlog/ServerLogServletInterface.java b/server/src/com/mirth/connect/plugins/serverlog/ServerLogServletInterface.java index 4cbc0c50eb..83d6ce3279 100644 --- a/server/src/com/mirth/connect/plugins/serverlog/ServerLogServletInterface.java +++ b/server/src/com/mirth/connect/plugins/serverlog/ServerLogServletInterface.java @@ -28,14 +28,15 @@ import com.mirth.connect.client.core.ClientException; import com.mirth.connect.client.core.Operation.ExecuteType; +import com.mirth.connect.client.core.api.ApiContentTypes; import com.mirth.connect.client.core.api.BaseServletInterface; import com.mirth.connect.client.core.api.MirthOperation; import com.mirth.connect.client.core.api.Param; @Path("/extensions/serverlog") @Tag(name = "Extension Services") -@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) +@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON }) public interface ServerLogServletInterface extends BaseServletInterface { public static final String PLUGIN_POINT = "Server Log"; @@ -44,10 +45,12 @@ public interface ServerLogServletInterface extends BaseServletInterface { @GET @Path("/") @Operation(summary = "Retrieves server log entries.") - @ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = { - @ExampleObject(name = "serverLogList", ref = "../apiexamples/server_log_item_list_xml") }), + @ApiResponse(content = { + @Content(mediaType = MediaType.APPLICATION_XML, examples = { + @ExampleObject(name = "serverLogList", ref = "../apiexamples/server_log_item_list_xml") }), @Content(mediaType = MediaType.APPLICATION_JSON, examples = { - @ExampleObject(name = "serverLogList", ref = "../apiexamples/server_log_item_list_json") }) }) + @ExampleObject(name = "serverLogList", ref = "../apiexamples/server_log_item_list_json") }), + @Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) @MirthOperation(name = "getMirthServerLogs", display = "View Server Log", permission = PERMISSION_VIEW, type = ExecuteType.ASYNC, auditable = false) public List getServerLogs(// @formatter:off @Param("fetchSize") @Parameter(description = "Specifies the maximum number of log items to return.", required = true, schema = @Schema(defaultValue = "100")) @QueryParam("fetchSize") int fetchSize, diff --git a/server/src/com/mirth/connect/server/MirthWebServer.java b/server/src/com/mirth/connect/server/MirthWebServer.java index b4ab2b3bbf..7f6b93e460 100644 --- a/server/src/com/mirth/connect/server/MirthWebServer.java +++ b/server/src/com/mirth/connect/server/MirthWebServer.java @@ -471,6 +471,8 @@ private void addApiServlets(HandlerList handlers, ServletContextHandler apiServl } ApiProviders apiProviders = getApiProviders(apiVersion); + apiProviders.providerClasses.add(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.class); + apiProviders.providerClasses.add(com.mirth.connect.client.core.api.providers.JacksonJsonObjectMapperConfig.class); // Add versioned Jersey API servlet ServletHolder jerseyVersionedServlet = apiServletContextHandler.addServlet(ServletContainer.class, "/*");