@ -17,8 +17,7 @@ import javax.ws.rs.core.Response;
context = "api/certificate-mgt/v1.0/admin/certificates" ,
context = "api/certificate-mgt/v1.0/admin/certificates" ,
tags = { "devicemgt_admin" } )
tags = { "devicemgt_admin" } )
@Api ( value = "Certificate Management" , description = "This API carries all certificate management related operations " +
@Api ( value = "Certificate Management" , description = "This API includes all the certificate management related operations" )
"such as get all the available devices, etc." )
@Path ( "/admin/certificates" )
@Path ( "/admin/certificates" )
@Produces ( MediaType . APPLICATION_JSON )
@Produces ( MediaType . APPLICATION_JSON )
@Consumes ( MediaType . APPLICATION_JSON )
@Consumes ( MediaType . APPLICATION_JSON )
@ -36,14 +35,14 @@ public interface CertificateManagementAdminService {
consumes = MediaType . APPLICATION_JSON ,
consumes = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
httpMethod = "POST" ,
httpMethod = "POST" ,
value = "Add a SSL certificate",
value = "Add ing a new SSL certificate",
notes = "Add a new SSL certificate ",
notes = "Add a new SSL certificate to the client end database.\n ",
tags = "Certificate Management" )
tags = "Certificate Management" )
@ApiResponses (
@ApiResponses (
value = {
value = {
@ApiResponse (
@ApiResponse (
code = 201 ,
code = 201 ,
message = "Created. \n Certificates have successfully been added ",
message = "Created. \n Successfully added the certificate. ",
responseHeaders = {
responseHeaders = {
@ResponseHeader (
@ResponseHeader (
name = "Content-Location" ,
name = "Content-Location" ,
@ -57,11 +56,11 @@ public interface CertificateManagementAdminService {
"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 L ocation header.",
message = "See Other. \n The source can be retrieved from the URL specified in the l ocation header.",
responseHeaders = {
responseHeaders = {
@ResponseHeader (
@ResponseHeader (
name = "Content-Location" ,
name = "Content-Location" ,
@ -72,7 +71,7 @@ public interface CertificateManagementAdminService {
response = ErrorResponse . class ) ,
response = ErrorResponse . class ) ,
@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 Server error occurred while adding certificates." ,
message = "Internal Server Error. \n Server error occurred while adding certificates." ,
@ -82,8 +81,10 @@ public interface CertificateManagementAdminService {
Response addCertificate (
Response addCertificate (
@ApiParam (
@ApiParam (
name = "enrollmentCertificates" ,
name = "enrollmentCertificates" ,
value = "certificate with serial, "
value = "The properties to add a new certificate. It includes the following:\n" +
+ "pem and tenant id" ,
"serial: The unique ID of the certificate.\n" +
"pem: Convert the OpenSSL certificate to the .pem format and base 64 encode the file.\n" +
"INFO: Upload the .pem file and base 64 encode it using a tool, such as the base64encode.in tool." ,
required = true ) EnrollmentCertificate [ ] enrollmentCertificates ) ;
required = true ) EnrollmentCertificate [ ] enrollmentCertificates ) ;
/ * *
/ * *
@ -98,13 +99,13 @@ public interface CertificateManagementAdminService {
consumes = MediaType . APPLICATION_JSON ,
consumes = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
httpMethod = "GET" ,
httpMethod = "GET" ,
value = "Getting Details of an SSL Certificate ManagementAdminService ",
value = "Getting Details of an SSL Certificate ",
notes = "Get the client side SSL certificate details ",
notes = "Get the client side SSL certificate details . ",
tags = "Certificate Management" )
tags = "Certificate Management" )
@ApiResponses ( value = {
@ApiResponses ( value = {
@ApiResponse (
@ApiResponse (
code = 200 ,
code = 200 ,
message = "OK. \n Successfully fetched information of the device .",
message = "OK. \n Successfully fetched the certificate details .",
response = CertificateResponse . class ,
response = CertificateResponse . class ,
responseHeaders = {
responseHeaders = {
@ResponseHeader (
@ResponseHeader (
@ -116,7 +117,7 @@ public interface CertificateManagementAdminService {
"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 (
@ -129,22 +130,25 @@ public interface CertificateManagementAdminService {
response = ErrorResponse . class ) ,
response = ErrorResponse . class ) ,
@ApiResponse (
@ApiResponse (
code = 404 ,
code = 404 ,
message = "Not Found. \n No device is found under the provided type and id .") ,
message = "Not Found. \n The specified certificate does not exist .") ,
@ApiResponse (
@ApiResponse (
code = 500 ,
code = 500 ,
message = "Internal Server Error. \n " +
message = "Internal Server Error. \n " +
"Server error occurred while retrieving information requested certificate .",
"Server error occurred while retrieving the requested certificate information .",
response = ErrorResponse . class )
response = ErrorResponse . class )
} )
} )
@Permission ( name = "View certificates" , permission = "/device-mgt/certificates/view" )
@Permission ( name = "View certificates" , permission = "/device-mgt/certificates/view" )
Response getCertificate (
Response getCertificate (
@ApiParam ( name = "serialNumber" ,
@ApiParam ( name = "serialNumber" ,
value = "Provide the serial number of the certificate that you wish to get the details of" ,
value = "The serial number of the certificate." ,
required = true )
required = true ,
defaultValue = "124380353155528759302" )
@PathParam ( "serialNumber" ) String serialNumber ,
@PathParam ( "serialNumber" ) String serialNumber ,
@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
) ;
) ;
@ -159,8 +163,8 @@ public interface CertificateManagementAdminService {
consumes = MediaType . APPLICATION_JSON ,
consumes = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
httpMethod = "GET" ,
httpMethod = "GET" ,
value = "Get c ertificates",
value = "Get ting Details of C ertificates",
notes = " You will have many certificates used for mutual SSL. In a situation where you wish to "
notes = " Get all the details of the certificates you have used for mutual SSL. In a situation where you wish to "
+ "view all the certificate details, it is not feasible to show all the details on one "
+ "view all the certificate details, it is not feasible to show all the details on one "
+ "page therefore the details are paginated" ,
+ "page therefore the details are paginated" ,
tags = "Certificate Management"
tags = "Certificate Management"
@ -168,7 +172,7 @@ public interface CertificateManagementAdminService {
@ApiResponses ( value = {
@ApiResponses ( value = {
@ApiResponse (
@ApiResponse (
code = 200 ,
code = 200 ,
message = "OK. \n List of certificates enrolled in the system ",
message = "OK. \n Successfully fetched the list of certificates. ",
response = CertificateList . class ,
response = CertificateList . class ,
responseContainer = "List" ,
responseContainer = "List" ,
responseHeaders = {
responseHeaders = {
@ -181,12 +185,12 @@ public interface CertificateManagementAdminService {
"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 " +
message = "See Other. \n " +
" Source can be retrieved from the URL specified at the Location header. ",
" The source can be retrieved from the URL specified in the location header.\n ",
responseHeaders = {
responseHeaders = {
@ResponseHeader (
@ResponseHeader (
name = "Content-Location" ,
name = "Content-Location" ,
@ -205,24 +209,28 @@ public interface CertificateManagementAdminService {
@ApiResponse (
@ApiResponse (
code = 500 ,
code = 500 ,
message = "Internal Server Error. \n " +
message = "Internal Server Error. \n " +
"Server error occurred while retrieving all certificates enrolled in the system .",
"Server error occurred while retrieving the certificate details .",
response = ErrorResponse . class )
response = ErrorResponse . class )
} )
} )
@Permission ( name = "View certificates" , permission = "/device-mgt/certificates/view" )
@Permission ( name = "View certificates" , permission = "/device-mgt/certificates/view" )
Response getAllCertificates (
Response getAllCertificates (
@ApiParam (
@ApiParam (
name = "offset" ,
name = "offset" ,
value = "Starting point within the complete list of items qualified." ,
value = "The starting pagination index for the complete list of qualified items" ,
required = false )
required = false ,
defaultValue = "0" )
@QueryParam ( "offset" ) int offset ,
@QueryParam ( "offset" ) int offset ,
@ApiParam (
@ApiParam (
name = "limit" ,
name = "limit" ,
value = "Maximum size of resource array to return." ,
value = "Provide how many certificate details you require from the starting pagination index/offset." ,
required = false )
required = false ,
defaultValue = "5" )
@QueryParam ( "limit" ) int limit ,
@QueryParam ( "limit" ) int limit ,
@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 ) ;
@ -232,20 +240,20 @@ public interface CertificateManagementAdminService {
consumes = MediaType . APPLICATION_JSON ,
consumes = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
produces = MediaType . APPLICATION_JSON ,
httpMethod = "DELETE" ,
httpMethod = "DELETE" ,
value = "Delet e an SSL c ertificate",
value = "Delet ing an SSL C ertificate",
notes = "Delete an SSL certificate that's on the client end" ,
notes = "Delete an SSL certificate that's on the client end" ,
tags = "Certificate Management" )
tags = "Certificate Management" )
@ApiResponses ( value = {
@ApiResponses ( value = {
@ApiResponse (
@ApiResponse (
code = 200 ,
code = 200 ,
message = "OK. \n Certificate has successfully been removed ") ,
message = "OK. \n Successfully removed the certificate. ") ,
@ApiResponse (
@ApiResponse (
code = 400 ,
code = 400 ,
message = "Bad Request. \n Invalid request or validation error." ,
message = "Bad Request. \n Invalid request or validation error." ,
response = ErrorResponse . class ) ,
response = ErrorResponse . class ) ,
@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 " +
@ -255,9 +263,10 @@ public interface CertificateManagementAdminService {
Response removeCertificate (
Response removeCertificate (
@ApiParam (
@ApiParam (
name = "serialNumber" ,
name = "serialNumber" ,
value = "Provide the serial number of the "
value = "The serial number of the certificate.\n" +
+ "certificate that you wish to delete" ,
"NOTE: Make sure that a certificate with the serial number you provide exists in the server. If no, first add a certificate." ,
required = true )
required = true ,
defaultValue = "12438035315552875930" )
@PathParam ( "serialNumber" ) String serialNumber ) ;
@PathParam ( "serialNumber" ) String serialNumber ) ;
}
}