@GET @Produces({"application/hal+json", "application/hal+json;concept=virtualaccount;v=1"}) @ApiOperation(value = "lists accounts", response = VirtualAccountsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "advisor", value = "advisors are allowed getting every virtualaccount"), @ExtensionProperty(name = "customer", value = "customer only allowed getting own locations")} )}, produces = "application/hal+json, application/hal+json;concept=locations;v=1", notes = "List all locations in a default projection, which is VirtualAccount version 1" + "Supported projections and versions are: " + "VirtualAccounts in version 1 " + "The Accept header for the default version is application/hal+json;concept=virtualaccount;v=1.0.0.... " + "The format for the default version is {....}", nickname = "listVirtualAccounts") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return accountsProducer.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
@GET @Produces({"application/hal+json", "application/hal+json;concept=customers;v=1"}) @ApiOperation(value = "lists customers", response = CustomersRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "advisor", value = "advisors are allowed getting every customer"), @ExtensionProperty(name = "customer", value = "customer only allowed getting own information")} )}, produces = "application/hal+json, application/hal+json;concept=customers;v=1", notes = "List all customers in a default projection, which is Customers version 1" + "Supported projections and versions are: " + "Customers in version 1 " + "The Accept header for the default version is application/hal+json;concept=customers;v=1.0.0.... " + "The format for the default version is {....}", nickname = "listCustomers") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return customersProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
@GET @Produces({"application/hal+json", "application/hal+json;concept=accountoverview;v=1"}) @ApiOperation(value = "lists accounts", response = AccountsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "advisor", value = "advisors are allowed getting every account"), @ExtensionProperty(name = "customer", value = "customer only allowed getting own accounts")} )}, produces = "application/hal+json, application/hal+json;concept=accountoverview;v=1", notes = "List all accounts in a default projection, which is AccountOverview version 1" + "Supported projections and versions are: " + "AccountOverview in version 1 " + "The Accept header for the default version is application/hal+json;concept=AccountOverview;v=1.0.0.... " + "The format for the default version is {....}", nickname = "listAccounts") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @QueryParam("customer") @DefaultValue("0") String customer, @HeaderParam("Accept") String accept) { return accountsProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request, customer); }
@GET @Produces({"application/hal+json", "application/hal+json;concept=location;v=1"}) @ApiOperation(value = "lists locations", response = LocationsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "advisor", value = "advisors are allowed getting every location"), @ExtensionProperty(name = "customer", value = "customer only allowed getting own locations")} )}, produces = "application/hal+json, application/hal+json;concept=locations;v=1", notes = "List all locations in a default projection, which is Location version 1" + "Supported projections and versions are: " + "Locations in version 1 " + "The Accept header for the default version is application/hal+json;concept=location;v=1.0.0.... " + "The format for the default version is {....}", nickname = "listLocations") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return locationsProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
/** * Retrieve Sensor data for the given time period. * * @param deviceId unique identifier for given device type instance * @param from starting time * @param to ending time * @return response with List<SensorRecord> object which includes sensor data which is requested */ @Path("device/stats/{deviceId}") @GET @Consumes("application/json") @Produces("application/json") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Sensor Stats", notes = "", response = Response.class, tags = "sampledevice", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:sampledevice:enroll") }) } ) Response getSensorStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to, @QueryParam("sensorType") String sensorType);
/** * Retrieve Sensor data for the device type */ @Path("stats/{deviceId}/sensors/{sensorName}") @GET @Consumes("application/json") @Produces("application/json") @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Retrieve Sensor data for the device type", notes = "", response = Response.class, tags = "connectedcup", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:connectedcup:enroll") }) } ) Response getDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, @QueryParam("from") long from, @QueryParam("to") long to);
@Path("device/ordercoffee") @POST @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Order Coffee", notes = "", response = Response.class, tags = "connectedcup", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:connectedcup:enroll") }) } ) Response orderCoffee(@QueryParam("deviceId") String deviceId);
@ApiOperation( value = "summary", notes = "notes", tags = {"tag1", "tag2"}, httpMethod = "GET", nickname = "test", produces = "application/json", consumes = "application/json", protocols = "http,https", code = 202, responseHeaders = {@ResponseHeader(name = "h1", response = int.class)}, extensions = {@Extension( name = "x-tagA", properties = {@ExtensionProperty(name = "x-tagAExt", value = "value of tagAExt")})}) void testBase();
@GET @Path("/test/") @ApiOperation(value = "Test", extensions = { @Extension(properties = { @ExtensionProperty(name = "externalPath", value = "/hello-world/v1/") })}) public Response getGreeting() { return Response.ok("Test").build(); }
@GET @Path("{virtualAccountNumber}") @Produces({"application/hal+json", "application/hal+json;concept=virtualaccount;v=1", "application/hal+json;concept=virtualaccount;v=2"}) @ApiOperation(value = "gets the information from a single position", response = VirtualAccountRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own information"), @ExtensionProperty(name = "advisor", value = "advisor allows getting all information")} )}, produces = "application/hal+json, application/hal+json;concept=virtualaccount;v=1, application/hal+json;concept=virtualaccount;v=2", notes = "obtain a single customer back in a default projection, which is VirtualAccount version 2" + " Supported projections and versions are:" + " VirtualAccount in version1 and VirtualAccount in version 2" + " The format of the default version is .... - The Accept Header is not marked as required in the " + "swagger - but it is needed - we are working on a solution to that", nickname = "getVirtualAccount") @ApiResponses(value = { @ApiResponse(code = 404, message = "virtualaccount not found.") }) public Response get(@Context UriInfo uriInfo, @Context Request request, @PathParam("virtualAccountNumber") @Pattern(regexp = "^[0-9]*$") String virtualAccountNumber, @HeaderParam("Accept") String accept) { LOGGER.info("Default version of virtualaccount collected"); return accountProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, virtualAccountNumber); }
@GET @Path("{customerNo}") @Produces({"application/hal+json", "application/hal+json;concept=customer;v=1", "application/hal+json;concept=customer;v=2"}) @ApiOperation(value = "gets the information from a single customer", response = CustomerRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own information"), @ExtensionProperty(name = "advisor", value = "advisor allows getting all information")} )}, produces = "application/hal+json, application/hal+json;concept=customer;v=1, application/hal+json;concept=customer;v=2", notes = "obtain a single customer back in a default projection, which is Customer version 2" + " Supported projections and versions are:" + " Customer in version1 and Customer in version 2" + " The format of the default version is .... - The Accept Header is not marked as required in the " + "swagger - but it is needed - we are working on a solution to that", nickname = "getCustomer") @ApiResponses(value = { @ApiResponse(code = 404, message = "No customer found.") }) public Response get(@Context UriInfo uriInfo, @Context Request request, @PathParam("customerNo") @Pattern(regexp = "^[0-9]{10}$") String customerNo, @HeaderParam("Accept") String accept) { LOGGER.info("Default version of customer collected"); return customerProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request, customerNo); }
@GET @Produces({ "application/hal+json", "application/hal+json;concept=reconciledtransactions;v=1"}) @ApiOperation(value = "obtain reconciled transactions (added API capabilities not though not implemented)", response = ReconciledTransactionsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting from own account"), @ExtensionProperty(name = "advisor", value = "advisor allows getting from every account")} )}, tags = {"select", "sort", "elements", "interval", "filter", "embed", "decorator", "reconciled"}, notes = "obtain a list of all reconciled transactions from an account" + "the reconciled transactions are user controlled checks and notes for transactions " + "such as - Yes I have verified that this transaction was correct and thus it is reconciled", produces = "application/hal+json, application/hal+json;concept=reconciledtransactions;v=1", nickname = "listReconciledTransactions") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept, @PathParam("regNo") String regNo, @PathParam("accountNo") String accountNo ) { return reconciledTxsProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, regNo, accountNo); }
@GET @Path("{id}") @Produces({ "application/hal+json", "application/hal+json;concept=reconciledtransaction;v=1" }) @LogDuration(limit = 50) @ApiOperation(value = "obtain a single reconciled transaction from a given account", response = ReconciledTransactionRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own account")} )}, produces = "application/hal+json, application/hal+json;concept=reconciledtransaction;v=1", nickname = "getReconciledTransaction") @ApiResponses(value = { @ApiResponse(code = 404, message = "No reconciled transaction found."), @ApiResponse(code = 415, message = "Content type not supported.") }) public Response get(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept, @PathParam("regNo") String regNo, @PathParam("accountNo") String accountNo, @PathParam("id") String id) { return reconciledTxProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, regNo, accountNo, id); }
@GET @Produces({ "application/hal+json", "application/hal+json;concept=transactionoverview;v=1" }) @ApiOperation( value = "obtain all transactions on account for a given account", response = TransactionsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting from own account"), @ExtensionProperty(name = "advisor", value = "advisor allows getting from every account")} )}, tags = {"sort", "elements", "interval", "transactions"}, produces = "application/hal+json, application/hal+json;concept=transactionoverview;v=1", nickname = "listTransactions" ) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept, @PathParam("regNo") String regNo, @PathParam("accountNo") String accountNo, @QueryParam("sort") String sort, @QueryParam("elements") String elements, @QueryParam("interval") String interval) { return transactionsProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, regNo, accountNo, sort, elements, interval); }
@GET @Path("{id}") @Produces({ "application/hal+json", "application/hal+json;concept=transaction;v=1"}) @LogDuration(limit = 50) @ApiOperation( value = "obtain the individual single transaction from an account", response = TransactionRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting from own account"), @ExtensionProperty(name = "advisor", value = "advisor allows getting from every account")} )}, produces = "application/hal+json, application/hal+json;concept=transaction;v=1", nickname = "getTransaction") @ApiResponses(value = { @ApiResponse(code = 404, message = "No transaction found."), @ApiResponse(code = 415, message = "Content type not supported.") }) /** * the use of authorization scopes to signal roles is a bit dubious and thus this may change in the future */ public Response get(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept, @PathParam("regNo") String regNo, @PathParam("accountNo") String accountNo, @PathParam("id") String id) { return transactionProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, regNo, accountNo, id); }
@GET @Path("{regNo}-{accountNo}") @Produces({"application/hal+json", "application/hal+json;concept=account;v=1", "application/hal+json;concept=account;v=2"}) @ApiOperation(value = "gets the information from a single account", response = AccountRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own account"), @ExtensionProperty(name = "advisor", value = "advisor allows getting every account")} )}, produces = "application/hal+json, application/hal+json;concept=account;v=1, application/hal+json;concept=account;v=2", notes = "obtain a single account back in a default projection, which is Account version 2" + " Supported projections and versions are:" + " AccountSparse in version1 and Account in version 2" + " The format of the default version is .... - The Accept Header is not marked as required in the " + "swagger - but it is needed - we are working on a solution to that", nickname = "getAccount") @ApiResponses(value = { @ApiResponse(code = 404, message = "No account found.") }) public Response get(@Context UriInfo uriInfo, @Context Request request, @PathParam("regNo") @Pattern(regexp = "^[0-9]{4}$") String regNo, @PathParam("accountNo") @Pattern(regexp = "^[0-9]+$") String accountNo, @HeaderParam("Accept") String accept) { LOGGER.info("Default version of account collected"); return accountProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request, regNo, accountNo); }
@GET @Path("{latitude}-{longitude}") @Produces({"application/hal+json", "application/hal+json;concept=location;v=1", "application/hal+json;concept=location;v=2"}) @ApiOperation(value = "gets the information from a single position", response = LocationRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own information"), @ExtensionProperty(name = "advisor", value = "advisor allows getting all information")} )}, produces = "application/hal+json, application/hal+json;concept=location;v=1, application/hal+json;concept=location;v=2", notes = "obtain a single customer back in a default projection, which is Location version 2" + " Supported projections and versions are:" + " Location in version1 and Location in version 2" + " The format of the default version is .... - The Accept Header is not marked as required in the " + "swagger - but it is needed - we are working on a solution to that", nickname = "getLocation") @ApiResponses(value = { @ApiResponse(code = 404, message = "location not found.") }) public Response get(@Context UriInfo uriInfo, @Context Request request, @PathParam("latitude") @Pattern(regexp = "^[0-9]+.[0-9]+,[0-9]*$") String latitude, @PathParam("longitude") @Pattern(regexp = "^[0-9]+.[0-9]+,[0-9]*$") String longitude, @HeaderParam("Accept") String accept) { LOGGER.info("Default version of location collected"); return locationProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, latitude, longitude); }
private List<VendorExtension> getVendorExtensions() { Extension[] extensions = springfoxLoader.extensions(); if (extensions.length == 1 && StringUtils.isEmpty(extensions[0].name())) { return Collections.emptyList(); } return Arrays.stream(extensions).map(extension -> { ExtensionProperty[] extensionProperties = extension.properties(); List<StringVendorExtension> vendorExtensions = Arrays.stream(extensionProperties) .map(property -> new StringVendorExtension(property.name(), property.value())).collect(Collectors.toList()); ObjectVendorExtension vendorExtension = new ObjectVendorExtension(extension.name()); vendorExtensions.forEach(vendorExtension::addProperty); return vendorExtension; }).collect(Collectors.toList()); }
@DELETE @Path("/{serialNumber}") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "DELETE", value = "Deleting an SSL Certificate", notes = "Delete an SSL certificate that's on the client end.", tags = "Certificate Management", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:delete") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Successfully removed the certificate."), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n The specified resource does not exist."), @ApiResponse( code = 500, message = "Internal Server Error. \n " + "Server error occurred while removing the certificate.", response = ErrorResponse.class)}) Response removeCertificate( @ApiParam( name = "serialNumber", value = "The serial number of the certificate.\n" + "NOTE: Make sure that a certificate with the serial number you provide exists in the server. If not, first add a certificate.", required = true, defaultValue = "12438035315552875930") @PathParam("serialNumber") String serialNumber);
@POST @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Check for device access authorization\n", notes = "This is an internal API that can be used to check for authorization.", response = DeviceAuthorizationResult.class, tags = "Authorization Administrative Service", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:authorization:verify") }) }) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Authorized device list will be delivered to the requested services", response = DeviceAuthorizationResult.class), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n The specified resource does not exist."), @ApiResponse( code = 415, message = "Unsupported media type. \n The entity of the request was in a not supported format."), @ApiResponse( code = 500, message = "Internal Server Error. \n Server error occurred while checking the authorization" + " for a specified set of devices.", response = ErrorResponse.class) }) Response isAuthorized(AuthorizationRequest authorizationRequest);
@GET @Path("/count") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Getting the User Count", notes = "Get the number of users in WSO2 IoTS via this REST API.", tags = "User Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:count") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Successfully fetched the user count.", response = BasicUserInfoList.class, responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body") }), @ApiResponse( code = 406, message = "Not Acceptable.\n The requested media type is not supported", response = ErrorResponse.class), @ApiResponse( code = 500, message = "Internal Server Error. \n Server error occurred while fetching the total number of users in WSO2 IoTS.", response = ErrorResponse.class) }) Response getUserCount();
@PUT @Path("/{id}/mark-checked") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "PUT", value = "Updating the Device Notification Status", notes = "When a user has read the the device notification the device notification status must " + "change from NEW to CHECKED. This API is used to update device notification status.", tags = "Device Notification Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "OK", response = Notification.class), @ApiResponse( code = 200, message = "Notification updated successfully. But the retrial of the updated " + "notification failed.", response = Notification.class), @ApiResponse( code = 500, message = "Error occurred while updating notification status.") } ) Response updateNotificationStatus( @ApiParam( name = "id", value = "The notification ID.", required = true, defaultValue = "1") @PathParam("id") @Max(45) int id);
@POST @Path("/deactivate-policy") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Deactivating Policies", notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive state.", tags = "Device Policy Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:deactivate") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "Successfully deactivated the policy."), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n The specified resource does not exist.", response = ErrorResponse.class), @ApiResponse( code = 500, message = "ErrorResponse in deactivating policies.", response = ErrorResponse.class) }) Response deactivatePolicies( @ApiParam( name = "policyIds", value = "The list of Policy IDs that needs to be deactivated.", required = true, defaultValue = "[1]") List<Integer> policyIds);
@PUT @Produces("application/json") @Path("apply-changes") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "PUT", value = "Applying Changes on Policies", notes = "Policies in the active state will be applied to new devices that register with WSO2 EMM based on" + " the policy enforcement criteria . In a situation where you need to make changes to existing" + " policies (removing, activating, deactivating and updating) or add new policies, the existing" + " devices will not receive these changes immediately. Once all the required changes are made" + " you need to apply the changes to push the policy changes to the existing devices.", tags = "Device Policy Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:changes") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "Successfully updated the EMM server with the policy changes."), @ApiResponse( code = 500, message = "ErrorResponse in deactivating policies.", response = ErrorResponse.class) }) Response applyChanges();
@PUT @Path("/priorities") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "PUT", value = "Updating the Policy Priorities", notes = "Make changes to the existing policy priority order by updating the priority order using this API.", tags = "Device Policy Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:priorities") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "Successfully updated the policy priority order."), @ApiResponse( code = 400, message = "Bad Request. Did not update the policy priority order.", response = ErrorResponse.class), @ApiResponse( code = 500, message = "Exception in updating the policy priorities.", response = ErrorResponse.class) }) Response updatePolicyPriorities( @ApiParam( name = "priorityUpdatedPolicies", value = "List of policies with priorities", required = true) List<PriorityUpdatedPolicyWrapper> priorityUpdatedPolicies);
@DELETE @Path("/enroll/{type}/{id}") @ApiOperation( httpMethod = "DELETE", value = "Unregistering a Device", notes = "Use this REST API to unregister a device.", tags = "Device Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:disenroll") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Successfully disenrolled the device."), @ApiResponse( code = 404, message = "Not Found. \n The specified resource does not exist."), @ApiResponse( code = 500, message = "Internal Server Error. \n " + "Server error occurred while dis-enrolling the device.") }) Response disEnrollDevice( @ApiParam(name = "type", value = "The unique device identifier.") @PathParam("type") String type, @ApiParam(name = "id", value = "The unique device identifier.") @PathParam("id") String id);
@POST @Path("/activate-policy") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Activating Policies", notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.", tags = "Device Policy Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:activate") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "Successfully activated the policy."), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n The specified resource/s does not exist.", response = ErrorResponse.class), @ApiResponse( code = 500, message = "Sever error whilst activating the policies.", response = ErrorResponse.class) }) Response activatePolicies( @ApiParam( name = "policyIds", value = "The list of the policy IDs to be activated", required = true, defaultValue = "[1]") List<Integer> policyIds);
@GET @Path("/checkUser") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Getting the User existence status", notes = "Check if the user exists in the user store.", tags = "User Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:is-exist") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Successfully fetched user exist status.", response = BasicUserInfoList.class, responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body") }), @ApiResponse( code = 406, message = "Not Acceptable.\n The requested media type is not supported", response = ErrorResponse.class), @ApiResponse( code = 500, message = "Internal Server Error. \n Server error occurred while fetching the " + "total user exist status.", response = ErrorResponse.class) }) Response isUserExists(@ApiParam( name = "username", value = "The username of the user.", required = true) @QueryParam("username") String userName);
@PUT @RolesAllowed("system") @Path("{virtualAccountNumber}") @Produces({"application/hal+json"}) @Consumes("application/json") @LogDuration(limit = 50) @ApiOperation(value = "Create new or update existing virtualaccount", response = VirtualAccountRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own customer"), @ExtensionProperty(name = "system", value = "system allows getting every customer") })}, notes = "PUT is used to create a new virtualaccount or used to alter the values attached to the virtual account", consumes = "application/json", produces = "application/hal+json, application/hal+json;concept=virtualaccount;v=1, application/hal+json;concept=virtualaccount;v=2", nickname = "updateVirtualAccount") @ApiResponses(value = { @ApiResponse(code = 400, message = "Could not update or create the virtualaccount", response = ErrorRepresentation.class), @ApiResponse(code = 415, message = "The content-Type was not supported"), @ApiResponse(code = 201, message = "New VirtualAccount Created", response = VirtualAccountRepresentation.class, responseHeaders = { @ResponseHeader(name = "VirtualAccount", description = "a link to the created resource"), @ResponseHeader(name = "Content-Type", description = "a link to the created resource"), @ResponseHeader(name = "X-Log-Token", description = "an ide for reference purposes in logs etc") }) }) public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request, @PathParam("virtualAccountNumber") String virtualAccountNumber, @ApiParam(value = "account") VirtualAccountUpdateRepresentation account) { if (!virtualAccountNumber.equals(account.getVaNumber())) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } Long no; try { no = Long.parseLong(virtualAccountNumber); } catch (NumberFormatException e) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } Optional<VirtualAccount> virtualaccount = archivist.findAccountByAccountNumber(no); VirtualAccount ac; if (virtualaccount.isPresent()) { ac = virtualaccount.get(); ac.addUnCommitted(new BigDecimal(account.getUnCommittedBalance())); } else { ac = new VirtualAccount(no, new BigDecimal(account.getTotalBalance()), new BigDecimal(account.getCommittedBalance()), new BigDecimal(account.getUnCommittedBalance())); } archivist.save(ac); CacheControl cc = new CacheControl(); int maxAge = 30; cc.setMaxAge(maxAge); return Response.created(URI.create(uriInfo.getPath())) .entity(new VirtualAccountRepresentation(ac, uriInfo)) .cacheControl(cc).expires(Date.from(CurrentTime.now().plusSeconds(maxAge))) .status(201) .type("application/hal+json;concept=virtualaccount;v=2") .build(); }
@PUT @RolesAllowed("advisor") @Path("{customerNo}") @Produces({"application/hal+json"}) @Consumes("application/json") @LogDuration(limit = 50) @ApiOperation(value = "Create new or update existing customer", response = CustomerRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own customer"), @ExtensionProperty(name = "system", value = "system allows getting coOwned customer"), @ExtensionProperty(name = "advisor", value = "advisor allows getting every customer") })}, notes = "PUT is used to create a new customer from scratch and may be used to alter the name of the customer", consumes = "application/json", produces = "application/hal+json, application/hal+json;concept=customer;v=1, application/hal+json;concept=customer;v=2", nickname = "updateCustomer") @ApiResponses(value = { @ApiResponse(code = 400, message = "Could not update or create the customer", response = ErrorRepresentation.class), @ApiResponse(code = 415, message = "The content-Type was not supported"), @ApiResponse(code = 201, message = "New Customer Created", response = CustomerRepresentation.class, responseHeaders = { @ResponseHeader(name = "Location", description = "a link to the created resource"), @ResponseHeader(name = "Content-Type", description = "a link to the created resource"), @ResponseHeader(name = "X-Log-Token", description = "an ide for reference purposes in logs etc") }) }) public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request, @PathParam("customerNo") @Pattern(regexp = "^[0-9]+$") String customerNo, @ApiParam(value = "customer") @Valid CustomerUpdateRepresentation customer) { if (!customerNo.equals(customer.getNumber())) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } Optional<Customer> cust = archivist.findCustomer(customerNo); Customer c; if (cust.isPresent()) { c = cust.get(); c.setSirname(customer.getFirstName()); c.setSirname(customer.getMiddleName()); c.setSirname(customer.getSirname()); } else { c = new Customer(customer.getFirstName(), customer.getMiddleName(), customer.getSirname()); } archivist.save(c); CacheControl cc = new CacheControl(); int maxAge = 30; cc.setMaxAge(maxAge); return Response.created(URI.create(uriInfo.getPath())) .entity(new CustomerRepresentation(c, uriInfo)) .cacheControl(cc).expires(Date.from(CurrentTime.now().plusSeconds(maxAge))) .status(201) .type("application/hal+json;concept=customer;v=2") .build(); }
@PUT @Path("{id}") @Produces({ "application/hal+json" }) @Consumes(MediaType.APPLICATION_JSON) @LogDuration(limit = 50) @ApiOperation(value = "Create new or update reconciled transaction", response = ReconciledTransactionRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "system", value = "customer allows getting coOwned account")} )}, notes = "reconciled transactions are user controlled checks and notes for transactions" + "such as - Yes I have verified that this transaction was correct and thus it is reconciled", nickname = "updateReconciledTransaction") @ApiResponses(value = { @ApiResponse(code = 400, message = "No updating possible", response = ErrorRepresentation.class), @ApiResponse(code = 415, message = "Content type not supported.") }) public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request, @PathParam("regNo") @Pattern(regexp = "^[0-9]{4}$") String regNo, @PathParam("accountNo") @Pattern(regexp = "^[0-9]+$") String accountNo, @PathParam("id") String id, @ApiParam(value = "reconciled transaction") @Valid ReconciledTransactionUpdateRepresentation rtx ) { String txId = Sanitizer.sanitize(id, false, true); Transaction tx = archivist.findTransaction(regNo, accountNo, txId); if (!defined(tx)) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } ReconciledTransaction reconciled = new ReconciledTransaction(rtx.getReconciled().contains("true"), rtx.getNote(), tx); archivist.save(reconciled); return new EntityResponseBuilder<>(reconciled.getTransaction(), t -> new ReconciledTransactionRepresentation(reconciled, t, uriInfo)) .name("reconciledtransaction") .version("1") .maxAge(60) .build(request); }
@PUT @RolesAllowed("advisor") @Path("{regNo}-{accountNo}") @Produces({"application/hal+json"}) @Consumes("application/json") @LogDuration(limit = 50) @ApiOperation(value = "Create new or update existing account", response = AccountRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own account"), @ExtensionProperty(name = "system", value = "system allows getting coOwned account"), @ExtensionProperty(name = "advisor", value = "advisor allows getting every account") })}, notes = "PUT is used to create a new account from scratch and may be used to alter the name of the account", consumes = "application/json", produces = "application/hal+json, application/hal+json;concept=account;v=1, application/hal+json;concept=account;v=2", nickname = "updateAccount") @ApiResponses(value = { @ApiResponse(code = 400, message = "Could not update or create the account", response = ErrorRepresentation.class), @ApiResponse(code = 415, message = "The content-Type was not supported"), @ApiResponse(code = 201, message = "New Account Created", response = AccountRepresentation.class, responseHeaders = { @ResponseHeader(name = "Location", description = "a link to the created resource"), @ResponseHeader(name = "Content-Type", description = "a link to the created resource"), @ResponseHeader(name = "X-Log-Token", description = "an ide for reference purposes in logs etc") }) }) public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request, @PathParam("regNo") @Pattern(regexp = "^[0-9]{4}$") String regNo, @PathParam("accountNo") @Pattern(regexp = "^[0-9]+$") String accountNo, @ApiParam(value = "account") @Valid AccountUpdateRepresentation account) { if (!regNo.equals(account.getRegNo()) || !accountNo.equals(account.getAccountNo())) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } Optional<Account> acc = archivist.findAccount(regNo, accountNo); Account a; if (acc.isPresent()) { a = acc.get(); a.setName(account.getName()); } else { a = new Account(regNo, accountNo, account.getName(), account.getCustomer()); } archivist.save(a); CacheControl cc = new CacheControl(); int maxAge = 30; cc.setMaxAge(maxAge); return Response.created(URI.create(uriInfo.getPath())) .entity(new AccountRepresentation(a, uriInfo)) .cacheControl(cc).expires(Date.from(CurrentTime.now().plusSeconds(maxAge))) .status(201) .type("application/hal+json;concept=account;v=2") .build(); }
@PUT @RolesAllowed("system") @Path("{latitude}-{longitude}") @Produces({"application/hal+json"}) @Consumes("application/json") @LogDuration(limit = 50) @ApiOperation(value = "Create new or update existing location", response = LocationRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "customer", value = "customer allows getting own customer"), @ExtensionProperty(name = "system", value = "system allows getting every customer") })}, notes = "PUT is used to create a new location from scratch and may be used to alter the values attached to the location", consumes = "application/json", produces = "application/hal+json, application/hal+json;concept=location;v=1, application/hal+json;concept=location;v=2", nickname = "updateLocation") @ApiResponses(value = { @ApiResponse(code = 400, message = "Could not update or create the location", response = ErrorRepresentation.class), @ApiResponse(code = 415, message = "The content-Type was not supported"), @ApiResponse(code = 201, message = "New Location Created", response = LocationRepresentation.class, responseHeaders = { @ResponseHeader(name = "Location", description = "a link to the created resource"), @ResponseHeader(name = "Content-Type", description = "a link to the created resource"), @ResponseHeader(name = "X-Log-Token", description = "an ide for reference purposes in logs etc") }) }) public Response createOrUpdate(@Context UriInfo uriInfo, @Context Request request, @PathParam("latitude") String latitude, @PathParam("longitude") String longitude, @ApiParam(value = "position") LocationUpdateRepresentation position) { if (!latitude.equals(position.getLatitude()) || (!longitude.equals(position.getLongitude()))) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } Optional<Location> location = archivist.findPosition(latitude, longitude); Location loc; if (location.isPresent()) { loc = location.get(); loc.setAmplitude(position.getAmplitude()); } else { loc = new Location(position.getLatitude(), position.getLongitude(), position.getAmplitude()); } archivist.save(loc); CacheControl cc = new CacheControl(); int maxAge = 30; cc.setMaxAge(maxAge); return Response.created(URI.create(uriInfo.getPath())) .entity(new LocationRepresentation(loc, uriInfo)) .cacheControl(cc).expires(Date.from(CurrentTime.now().plusSeconds(maxAge))) .status(201) .type("application/hal+json;concept=location;v=2") .build(); }
/** * Save a list of certificates and relevant information in the database. * * @param enrollmentCertificates List of all the certificates which includes the tenant id, certificate as * a pem and a serial number. * @return Status of the data persist operation. */ @POST @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Adding a new SSL certificate", notes = "Add a new SSL certificate to the client end database.\n", tags = "Certificate Management", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:add") }) } ) @ApiResponses( value = { @ApiResponse( code = 201, message = "Created. \n Successfully added the certificate.", responseHeaders = { @ResponseHeader( name = "Content-Location", description = "The URL of the added certificates."), @ResponseHeader( name = "Content-Type", description = "The content type of the body"), @ResponseHeader( name = "ETag", description = "Entity Tag of the response resource.\n" + "Used by caches, or in conditional requests."), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource was last modified.\n" + "Used by caches, or in conditional requests.")}), @ApiResponse( code = 303, message = "See Other. \n The source can be retrieved from the URL specified in the location header.", responseHeaders = { @ResponseHeader( name = "Content-Location", description = "The Source URL of the document.")}), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 415, message = "Unsupported Media Type. \n The format of the requested entity was not supported."), @ApiResponse( code = 500, message = "Internal Server Error. \n Server error occurred while adding certificates.", response = ErrorResponse.class) }) Response addCertificate( @ApiParam( name = "enrollmentCertificates", value = "The properties to add a new certificate. It includes the following: \n" + "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);
/** * Get a certificate when the serial number is given. * * @param serialNumber serial of the certificate needed. * @return certificate response. */ @GET @Path("/{serialNumber}") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Getting Details of an SSL Certificate", notes = "Get the client side SSL certificate details.", tags = "Certificate Management", extensions = { @Extension(properties = { @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:details") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK. \n Successfully fetched the certificate details.", response = CertificateResponse.class, responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body"), @ResponseHeader( name = "ETag", description = "Entity Tag of the response resource.\n" + "Used by caches, or in conditional requests."), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource was last modified.\n" + "Used by caches, or in conditional requests."), }), @ApiResponse( code = 304, message = "Not Modified. \n " + "Empty body because the client already has the latest version of the requested resource."), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n The specified certificate does not exist."), @ApiResponse( code = 500, message = "Internal Server Error. \n " + "Server error occurred while retrieving the requested certificate information.", response = ErrorResponse.class) }) Response getCertificate( @ApiParam(name = "serialNumber", value = "The serial number of the certificate.", required = true, defaultValue = "124380353155528759302") @PathParam("serialNumber") String serialNumber, @ApiParam( name = "If-Modified-Since", 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) @HeaderParam("If-Modified-Since") String ifModifiedSince );
@PUT @Path("/{type}/{id}/changestatus") @ApiOperation( produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, httpMethod = "PUT", value = "Change device status by device id.", notes = "Returns the status of the changed device operation.", tags = "Device Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:change-status") }) } ) @ApiResponses( value = { @ApiResponse( code = 200, message = "OK. \n Successfully changed the device status.", response = Device.class, responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body"), @ResponseHeader( name = "ETag", description = "Entity Tag of the response resource.\n" + "Used by caches, or in conditional requests."), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource has been modified the last time.\n" + "Used by caches, or in conditional requests."), }), @ApiResponse( code = 304, message = "Not Modified. Empty body because the client already has the latest " + "version of the requested resource."), @ApiResponse( code = 400, message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class), @ApiResponse( code = 404, message = "Not Found. \n No device is found under the provided type and id.", response = ErrorResponse.class), @ApiResponse( code = 500, message = "Internal Server Error. \n " + "Server error occurred while retrieving information requested device.", response = ErrorResponse.class) }) Response changeDeviceStatus( @ApiParam( name = "type", value = "The device type, such as ios, android or windows.", required = true) @PathParam("type") @Size(max = 45) String type, @ApiParam( name = "id", value = "Device id", required = true) @PathParam("id") @Size(max = 45) String id, @ApiParam( name = "newStatus", value = "New status of the device.", required = true) @QueryParam("newStatus") EnrolmentInfo.Status newStatus);
/** * Get data to show device locations in a map */ @GET @Path("stats/deviceLocations") @ApiOperation( consumes = "application/json", produces = "application/json", httpMethod = "GET", value = "Retrieve locations of devices", notes = "", response = Response.class, tags = "Geo Service Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:analytics-view") }) } ) @ApiResponses(value = { @ApiResponse( code = 200, message = "OK.", response = Response.class, responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body"), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource was last modified.\n" + "Used by caches, or in conditional requests."), }), @ApiResponse( code = 400, message = "Bad Request. \n Invalid parameters found.", response = Response.class), @ApiResponse( code = 401, message = "Unauthorized. \n Unauthorized request."), @ApiResponse( code = 500, message = "Internal Server Error. \n Error on retrieving stats", response = Response.class) }) Response getGeoDeviceLocations( @ApiParam( name = "minLat", value = "minimum latitude", required = true) @QueryParam("minLat") double minLat, @ApiParam( name = "maxLat", value = "maxmimum latitude", required = true) @QueryParam("maxLat") double maxLat, @ApiParam( name = "minLong", value = "minimum longitude", required = true) @QueryParam("minLong") double minLong, @ApiParam( name = "maxLong", value = "maximum longitudeude", required = true) @QueryParam("maxLong") double maxLong, @ApiParam( name = "zoom", value = "zoom level", required = true) @QueryParam("zoom") int zoom);
@Path("/id/{groupId}/devices/add") @POST @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = HTTPConstants.HEADER_POST, value = "Add devices to group.", notes = "Add existing devices to the device group.", tags = "Device Group Management", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-add") }) } ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully add devices to the group.", responseHeaders = { @ResponseHeader( name = "Content-Type", description = "The content type of the body"), @ResponseHeader( name = "ETag", description = "Entity Tag of the response resource.\n" + "Used by caches, or in conditional requests."), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource has been modified the last time.\n" + "Used by caches, or in conditional requests."), }), @ApiResponse( code = 304, message = "Not Modified. \n Empty body because the client has already the latest version of " + "the requested resource."), @ApiResponse( code = 404, message = "No groups found.", response = ErrorResponse.class), @ApiResponse( code = 406, message = "Not Acceptable.\n The requested media type is not supported."), @ApiResponse( code = 500, message = "Internal Server Error. \n Server error occurred while adding devices to the group.", response = ErrorResponse.class) }) Response addDevicesToGroup(@ApiParam( name = "groupId", value = "ID of the group.", required = true) @PathParam("groupId") int groupId, @ApiParam( name = "deviceIdentifiers", value = "Device identifiers of the devices which needed be added.", required = true) @Valid List<DeviceIdentifier> deviceIdentifiers);