Merge pull request #391 from shavidissa/master

Added swagger annotations and refined the messages
merge-requests/1/head
Harshan Liyanage 8 years ago committed by GitHub
commit 242253b8f2

@ -36,7 +36,7 @@ import java.util.List;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@ApiModel( @ApiModel(
value = "PlatformConfiguration", value = "PlatformConfiguration",
description = "This class carries all information related to a Tenant configuration" description = "This class carries all the information related to Android platform configurations."
) )
public class AndroidPlatformConfiguration implements Serializable { public class AndroidPlatformConfiguration implements Serializable {
public static final int INVALID_NOTIFIER_FREQUENCY = -1; public static final int INVALID_NOTIFIER_FREQUENCY = -1;

@ -39,7 +39,7 @@ import java.util.List;
tags = {"devicemgt_android"}) tags = {"devicemgt_android"})
@Api(value = "Android Device Management", @Api(value = "Android Device Management",
description = "This carries all the resources related to Android device management functionalities") description = "This carries all the resources related to the Android device management functionalities.")
@Path("/devices") @Path("/devices")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ -51,13 +51,14 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Update the application list of a device", value = "Updating the Application Details on Android Devices",
notes = "Update the details of the applications that are installed on Android devices.",
tags = "Android Device Management" tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Application list has been updated successfully", message = "OK. \n Successfully updated the application details.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -71,17 +72,17 @@ public interface DeviceManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
@ -91,14 +92,14 @@ public interface DeviceManagementService {
Response updateApplicationList( Response updateApplicationList(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier") value = "The unique device identifier.")
@NotNull @NotNull
@Size(min = 2 , max = 45) @Size(min = 2 , max = 45)
@Pattern(regexp = "^[A-Za-z0-9]*$") @Pattern(regexp = "^[A-Za-z0-9]*$")
@PathParam("id") String id, @PathParam("id") String id,
@ApiParam( @ApiParam(
name = "applications", name = "applications",
value = "List of applications that need to be persisted against the device") value = "The properties to update application details. Multiple applications can be updated using comma separated values.")
List<AndroidApplication> androidApplications); List<AndroidApplication> androidApplications);
@PUT @PUT
@ -106,16 +107,18 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Get the operation list pending for the device", value = "Getting the Pending Operation List",
responseContainer = "List", responseContainer = "List",
notes = "The Android agent communicates with the server to get the operations that are queued up " + notes = "The Android agent communicates with the server to get the operations that are queued up " +
"at the server end for a given device using via this particular resource", "at the server end via this REST API." +
" While getting the pending operations the details of the operations executed at the device end is shared with the server. " +
"The server then updates the status of the operations that were carried out on the device.",
response = Operation.class, response = Operation.class,
tags = "Android Device Management") tags = "Android Device Management")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully fetched the pending application list of the Android device.", message = "OK. \n Successfully fetched the pending operations of the Android device.",
response = Operation.class, response = Operation.class,
responseContainer = "List", responseContainer = "List",
responseHeaders = { responseHeaders = {
@ -128,33 +131,36 @@ public interface DeviceManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.") "Used by caches, or in conditional requests.")
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching policies.") message = "Internal Server Error. \n Server error occurred while fetching the list of pending operations.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response getPendingOperations( Response getPendingOperations(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier") value = "The unique device identifier.",
required = true)
@PathParam("id") String id, @PathParam("id") String id,
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200.",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince, @HeaderParam("If-Modified-Since") String ifModifiedSince,
@ApiParam( @ApiParam(
name = "resultOperations", name = "resultOperations",
value = "Device Operation Status") value = "Properties to update the device operations and their status.")
List<? extends Operation> resultOperations); List<? extends Operation> resultOperations);
@POST @POST
@ -162,17 +168,17 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Register an Android Device", value = "Registering an Android Device",
notes = "When carrying out device registration via an Android device, you need to initially install" + notes = "When registering an Android device, you need to install" +
" an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," + " the Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," +
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
" an Android Agent on the respective device", " an Android Agent. This API can be mainly used to test the device enrollment process.",
tags = "Android Device Management" tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
message = "Created. \n Device enrollment has successfully been created", message = "Created. \n Successfully created an instance of the device.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -186,11 +192,11 @@ public interface DeviceManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse( @ApiResponse(
code = 303, code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -200,14 +206,16 @@ public interface DeviceManagementService {
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device.") "Server error occurred while adding a new device.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Response enrollDevice(@ApiParam(
name = "device",
value = "The properties required to enroll a device.")
@Valid AndroidDevice device); @Valid AndroidDevice device);
@GET @GET
@ -215,7 +223,7 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "GET", httpMethod = "GET",
value = "Getting the Registration Status of an Android Device", value = "Getting the Registration Status of an Android Device",
notes = "Use this REST API to retrieve the registration status of an Android device", notes = "Use this REST API to retrieve the registration status of an Android device.",
tags = "Android Device Management" tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -232,12 +240,12 @@ public interface DeviceManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported"),
@ -249,11 +257,13 @@ public interface DeviceManagementService {
Response isEnrolled( Response isEnrolled(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier") value = "The unique device identifier")
@PathParam("id") String id, @PathParam("id") String id,
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince); @HeaderParam("If-Modified-Since") String ifModifiedSince);
@ -262,14 +272,14 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating the Registration Details of an Android Device", value = "Updating the Registration Details of an Android Device",
notes = "Use this REST API to update the registration details of an Android device", notes = "Use this REST API to update the registration details of an Android device.",
tags = "Android Device Management" tags = "Android Device Management"
) )
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Device enrollment has been updated successfully", message = "OK. \n Successfully updated the device enrollment details.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -283,17 +293,17 @@ public interface DeviceManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
@ -303,27 +313,27 @@ public interface DeviceManagementService {
Response modifyEnrollment( Response modifyEnrollment(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier") value = "The unique device identifier.")
@PathParam("id") String id, @PathParam("id") String id,
@ApiParam( @ApiParam(
name = "device", name = "device",
value = "Device information to be modify") @Valid AndroidDevice androidDevice); value = "The properties of required to update device enrollment details.") @Valid AndroidDevice androidDevice);
@DELETE @DELETE
@Path("/{id}") @Path("/{id}")
@ApiOperation( @ApiOperation(
httpMethod = "DELETE", httpMethod = "DELETE",
value = "Un-register an Android Device", value = "Unregistering an Android Device",
notes = "Use this REST API to un-register a specific Android device", notes = "Use this REST API to unregister an Android device.",
tags = "Android Device Management" tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Device has successfully been dis-enrolled"), message = "OK. \n Successfully disenrolled the device."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
@ -333,7 +343,7 @@ public interface DeviceManagementService {
Response disEnrollDevice( Response disEnrollDevice(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier") value = "The unique device identifier.")
@PathParam("id") String id); @PathParam("id") String id);
} }

@ -34,8 +34,7 @@ import javax.ws.rs.core.Response;
context = "api/device-mgt/android/v1.0/configuration", context = "api/device-mgt/android/v1.0/configuration",
tags = {"devicemgt_android"}) tags = {"devicemgt_android"})
@Api(value = "Android Configuration Management", description = "This API carries all resource associated with " + @Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.")
"manipulating the general configurations of Android platform")
@Path("/configuration") @Path("/configuration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ -46,14 +45,14 @@ public interface DeviceTypeConfigurationService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting Android Platform Configurations", value = "Getting Android Platform Configurations",
notes = "Get the Android platform configuration details using this REST API", notes = "Get the Android platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Android Configuration Management" tags = "Android Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully fetched Android platform configuration.", message = "OK. \n Successfully fetched the Android platform configurations.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
@ -65,27 +64,29 @@ public interface DeviceTypeConfigurationService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Android platform configuration.")
}) })
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view") @Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
Response getConfiguration( Response getConfiguration(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince); @HeaderParam("If-Modified-Since") String ifModifiedSince);
@ -94,14 +95,14 @@ public interface DeviceTypeConfigurationService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating Android Platform Configuration.", value = "Updating Android Platform Configurations",
notes = "Update the Android platform configurations using this REST API.", notes = "Update the Android platform configurations using this REST API.",
tags = "Android Configuration Management" tags = "Android Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Android platform configuration has been updated successfully", message = "OK. \n Successfully updated the Android platform configurations.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -115,26 +116,26 @@ public interface DeviceTypeConfigurationService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying Android platform configuration.") "Server error occurred while modifying the Android platform configuration.")
}) })
@Permission(name = "Manage Configurations", permission = "/device-mgt/platform-configurations/manage") @Permission(name = "Manage Configurations", permission = "/device-mgt/platform-configurations/manage")
Response updateConfiguration( Response updateConfiguration(
@ApiParam(name = "configuration", @ApiParam(name = "configuration",
value = "AndroidPlatformConfiguration") value = "The properties to update the Android platform configurations.")
@Valid AndroidPlatformConfiguration androidPlatformConfiguration); @Valid AndroidPlatformConfiguration androidPlatformConfiguration);
@GET @GET
@ -143,9 +144,9 @@ public interface DeviceTypeConfigurationService {
@ApiOperation( @ApiOperation(
produces = MediaType.TEXT_PLAIN, produces = MediaType.TEXT_PLAIN,
httpMethod = "GET", httpMethod = "GET",
value = "Getting the License Agreement for Android Device Registration", value = "Getting the License Agreement for the Android Device Registration",
notes = "Use this REST API to retrieve the license agreement that is used for the Android device " + notes = "Use this REST API to retrieve the license agreement that is used for the Android device " +
"registration process", "registration process.",
response = String.class, response = String.class,
tags = "Android Configuration Management") tags = "Android Configuration Management")
@ApiResponses(value = { @ApiResponses(value = {
@ -163,27 +164,29 @@ public interface DeviceTypeConfigurationService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Android license configuration.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response getLicense( Response getLicense(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200.",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException; @HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException;

@ -35,9 +35,9 @@ import javax.ws.rs.core.Response;
context = "api/device-mgt/android/v1.0/events", context = "api/device-mgt/android/v1.0/events",
tags = {"devicemgt_android"}) tags = {"devicemgt_android"})
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.To enable Eventing need to" + @Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" +
" configure as ref-https://docs.wso2.com/display/EMM210/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " + " configure WSO2 EMM as explained in https://docs.wso2.com/display/EMM220/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " +
"https://docs.wso2.com/display/EMM210/Creating+a+New+Event+Stream+and+Receiver") "https://docs.wso2.com/display/EMM220/Creating+a+New+Event+Stream+and+Receiver")
@Path("/events") @Path("/events")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ -49,13 +49,13 @@ public interface EventReceiverService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Event publishing via REST API.", value = "Publishing Events",
notes = "Publish events received by the EMM Android client to WSO2 DAS using this API.", notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.",
tags = "Event Receiver" tags = "Event Receiver"
) )
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse(code = 201, message = "Created. \n Event is published successfully. Location header " + @ApiResponse(code = 201, message = "Created. \n Successfully published the event. Location header " +
"contains URL of newly enrolled device", "contains URL of newly enrolled device",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
@ -70,12 +70,12 @@ public interface EventReceiverService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.") "Used by caches, or in conditional requests.")
}), }),
@ApiResponse( @ApiResponse(
code = 303, code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -85,7 +85,7 @@ public interface EventReceiverService {
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
@ -104,10 +104,10 @@ public interface EventReceiverService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting event details for a given time period.", value = "Getting event details for a given time period.",
notes = "Get the event details of a device for a given time duration using this API.Request must contain " + notes = "Get the event details of a device for a given time duration using this API. The request must contain " +
"the device identifier. Optionally, both, date from and date to value should be present to get " + "the device identifier. Optionally, both date from and date to value should be present to get " +
"alerts between times. Based on device type and the device identifier also filtering can be done" + "alerts between a specified time. Filtering can also be done based on the device type and the device identifier." +
"(This cannot be combined with to and from parameters).", "(This cannot be combined with the to and from parameters).",
response = DeviceState.class, response = DeviceState.class,
responseContainer = "List", responseContainer = "List",
tags = "Event Receiver" tags = "Event Receiver"
@ -116,12 +116,11 @@ public interface EventReceiverService {
value = { value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Event details of a device for a given time duration have been successfully fetched", message = "OK. \n Successfully fetched the event details of the specified device for a given time duration.",
response = DeviceState.class, responseContainer = "List"), response = DeviceState.class, responseContainer = "List"),
@ApiResponse( @ApiResponse(
code = 303, code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at" + message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
" the Location header.",
responseHeaders = { responseHeaders = {
@ResponseHeader(name = "Content-Location", description = "Source URL of the document.") @ResponseHeader(name = "Content-Location", description = "Source URL of the document.")
}), }),
@ -132,39 +131,44 @@ public interface EventReceiverService {
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n Invalid request or validation error. You must provide" + message = "Bad Request. \n Invalid request or validation error. You must provide" +
" the device identifier. Additionally, the device identifier can be combined with either the type" + " the device identifier. Additionally, the device identifier can be combined with either the device type" +
" OR date from and to."), " OR the from and to date."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource requested does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Error occurred while getting published events for specific device.") message = "Error occurred while getting the published events for the specified device.")
}) })
@Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android") @Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android")
Response retrieveAlerts( Response retrieveAlerts(
@ApiParam( @ApiParam(
name = "id", name = "id",
value = "Device Identifier to be need to retrieve events.", value = "The unique device identifier.",
required = true) required = true)
@Size(min = 2, max = 45) @Size(min = 2, max = 45)
@QueryParam("id") String deviceId, @QueryParam("id") String deviceId,
@ApiParam( @ApiParam(
name = "from", name = "from",
value = "From Date.") value = "Specify the time and date from when you want to get the data." +
"Provide the time and date format in the unix/epoch format as the value for {unixTimestamp}. Use a Epoch convertor, to convert the time and date to this format.")
@QueryParam("from") long from, @QueryParam("from") long from,
@ApiParam( @ApiParam(
name = "to", name = "to",
value = "To Date.") value = "Specify the time and date up to when you require the data." +
"Provide the time and date format in the unix/epoch format as the value for {unixTimestamp}. Use a Epoch convertor, to convert the time and date to this format.")
@QueryParam("to") long to, @QueryParam("to") long to,
@ApiParam( @ApiParam(
name = "type", name = "type",
value = "Type of the Alert to be need to retrieve events.") value = "The alert type to retrieve the events." +
"Provide APPLICATION_STATE or RUNTIME_STATE as the value.")
@Size(min = 2, max = 45) @Size(min = 2, max = 45)
@QueryParam("type") String type, @QueryParam("type") String type,
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince); @HeaderParam("If-Modified-Since") String ifModifiedSince);

@ -51,7 +51,7 @@
<property name="version" value="1.0"/> <property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/> <property name="host" value="localhost:9443"/>
<property name="schemes" value="https" /> <property name="schemes" value="https" />
<property name="basePath" value="/api-device-mgt-android-v1.0"/> <property name="basePath" value="/api/device-mgt/android/v1.0"/>
<property name="title" value="Android Device Management API Definitions"/> <property name="title" value="Android Device Management API Definitions"/>
<property name="contact" value="dev@wso2.org"/> <property name="contact" value="dev@wso2.org"/>
<property name="license" value="Apache 2.0"/> <property name="license" value="Apache 2.0"/>

@ -50,7 +50,7 @@ public interface ConfigurationMgtService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting Windows Platform Configurations", value = "Getting Windows Platform Configurations",
notes = "Get the Windows platform configuration details using this REST API", notes = "Get the Windows platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Windows Configuration Management" tags = "Windows Configuration Management"
) )
@ -74,16 +74,16 @@ public interface ConfigurationMgtService {
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Applications can be blacklisted via the application restriction policy too.."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n Th resource to be deleted does not exist."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Windows platform configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.")
}) })
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view") @Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
PlatformConfiguration getConfiguration() throws WindowsConfigurationException; PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
@ -100,14 +100,14 @@ public interface ConfigurationMgtService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating Windows Platform Configuration.", value = "Updating Windows Platform Configurations",
notes = "Update the Windows platform configurations using this REST API.", notes = "Update the Windows platform configurations using this REST API.",
tags = "Windows Configuration Management" tags = "Windows Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Windows platform configuration has been updated successfully", message = "OK. \n Successfully updated the Windows platform configurations.",
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
name = "Content-Location", name = "Content-Location",
@ -121,25 +121,28 @@ public interface ConfigurationMgtService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n Invalid request or validation error."), message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 415, code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."), message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying Windows platform configuration.") "Server error occurred while modifying the Windows platform configurations.")
}) })
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage") @Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message updateConfiguration( @ApiParam(name = "configuration", Message updateConfiguration
value = "PlatformConfiguration")PlatformConfiguration configuration) throws WindowsConfigurationException; ( @ApiParam(
name = "configuration",
value = "The properties to update the Windows platform configurations.")
PlatformConfiguration configuration) throws WindowsConfigurationException;
@GET @GET
@Path("license") @Path("license")
@ -147,9 +150,9 @@ public interface ConfigurationMgtService {
@ApiOperation( @ApiOperation(
produces = MediaType.TEXT_PLAIN, produces = MediaType.TEXT_PLAIN,
httpMethod = "GET", httpMethod = "GET",
value = "Getting the License Agreement for Windows Device Registration", value = "Getting the License Agreement to Register a Windows Device",
notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " + notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " +
"registration process", "registration process.",
response = String.class, response = String.class,
tags = "Windows Configuration Management") tags = "Windows Configuration Management")
@ApiResponses(value = { @ApiResponses(value = {
@ -167,27 +170,29 @@ public interface ConfigurationMgtService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
}), }),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n Resource to be deleted does not exist."), message = "Not Found. \n The specified resource does not exist."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Windows license configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Windows license configuration.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows")
Response getLicense( Response getLicense(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified", value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException; @HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException;

Loading…
Cancel
Save