@ApiOperation(value="Download Resource (downloadResource)",notes="Download Resource based on the provided Resource Id."+SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
@ApiResponse(code=401,message="User is not authorized to save device attributes for selected device. Most likely, User belongs to different Customer or Tenant."),
@ApiResponse(code=500,message="The exception was thrown during processing the request. "+
"Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an error stacktrace."),
@ApiOperation(value="Delete entity time-series data (deleteEntityTimeseries)",
notes="Delete time-series for selected entity based on entity id, entity type and keys."+
" Use 'deleteAllDataForKeys' to delete all time-series data."+
" Use 'startTs' and 'endTs' to specify time-range instead. "+
" Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. "+
TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
produces=MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(value={
@ApiResponse(code=200,message="Timeseries for the selected keys in the request was removed. "+
"Platform creates an audit log event about entity timeseries removal with action type 'TIMESERIES_DELETED'."),
@ApiResponse(code=400,message="Platform returns a bad request in case if keys list is empty or start and end timestamp values is empty when deleteAllDataForKeys is set to false."),
@ApiResponse(code=401,message="User is not authorized to delete entity timeseries for selected entity. Most likely, User belongs to different Customer or Tenant."),
@ApiResponse(code=500,message="The exception was thrown during processing the request. "+
"Platform creates an audit log event about entity timeseries removal with action type 'TIMESERIES_DELETED' that includes an error stacktrace."),
@ApiParam(value="If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set.")
notes="Delete device attributes using provided Device Id, scope and a list of keys. "+
"Referencing a non-existing Device Id will cause an error"+TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
produces=MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(value={
@ApiResponse(code=200,message="Device attributes was removed for the selected keys in the request. "+
"Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED'."),
@ApiResponse(code=400,message="Platform returns a bad request in case if keys or scope are not specified."),
@ApiResponse(code=401,message="User is not authorized to delete device attributes for selected entity. Most likely, User belongs to different Customer or Tenant."),
@ApiResponse(code=500,message="The exception was thrown during processing the request. "+
"Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED' that includes an error stacktrace."),
@ApiResponse(code=200,message="Entity attributes was removed for the selected keys in the request. "+
"Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED'."),
@ApiResponse(code=400,message="Platform returns a bad request in case if keys or scope are not specified."),
@ApiResponse(code=401,message="User is not authorized to delete entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant."),
@ApiResponse(code=500,message="The exception was thrown during processing the request. "+
"Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED' that includes an error stacktrace."),
Stringmessage=String.format("String value length [%d] for key [%s] is greater than maximum allowed [%d]",entry.getValue().textValue().length(),key,maxStringValueLength);
notes="Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error."+SYSTEM_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Get Tenants (getTenants)",notes="Returns a page of tenants registered in the platform. "+PAGE_DATA_PARAMETERS+SYSTEM_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Create Or update Tenant Profile (saveTenantProfile)",
notes="Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as "+UUID_WIKI_LINK+
"The newly created Tenant Profile Id will be present in the response. "+
"Specify existing Tenant Profile Id id to update the Tenant Profile. "+
"Referencing non-existing Tenant Profile Id will cause 'Not Found' error. "+
"\n\nUpdate of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. "+
"\n\nThe **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. "+
"\n\nYou have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. "+
"You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). "+
"The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. "+
"Let's review the example of tenant profile data below: "+
notes="Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. "+SYSTEM_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Get Tenant Profiles (getTenantProfiles)",notes="Returns a page of tenant profiles registered in the platform. "+PAGE_DATA_PARAMETERS+SYSTEM_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Get Tenant Profiles Info (getTenantProfileInfos)",notes="Returns a page of tenant profile info objects registered in the platform. "
publicTwoFaAccountConfiggenerateTwoFaAccountConfig(@ApiParam(value="2FA provider type to generate new account config for",defaultValue="TOTP",required=true)
@ApiOperation(value="Get User Token (getUserToken)",
notes="Returns the token of the User based on the provided User Id. "+
"If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. "+
"If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. ")
@ApiOperation(value="Send or re-send the activation email",
notes="Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. "+SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Enable/Disable User credentials (setUserCredentialsEnabled)",
notes="Enables or Disables user credentials. Useful when you would like to block user account without deleting it. "+PAGE_DATA_PARAMETERS+TENANT_AUTHORITY_PARAGRAPH)
privatestaticfinalStringWIDGET_TYPE_DESCRIPTION="Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory.";
privatestaticfinalStringWIDGET_TYPE_DETAILS_DESCRIPTION="Widget Type Details extend Widget Type and add image and description properties. "+
"Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. ";
privatestaticfinalStringWIDGET_TYPE_INFO_DESCRIPTION="Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON";
@ApiOperation(value="Get Widget Type Details (getWidgetTypeById)",
notes="Get the Widget Type Details based on the provided Widget Type Id. "+WIDGET_TYPE_DETAILS_DESCRIPTION+SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Get all Widget types for specified Bundle (getBundleWidgetTypes)",
notes="Returns an array of Widget Type objects that belong to specified Widget Bundle."+WIDGET_TYPE_DESCRIPTION+" "+SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
@ApiOperation(value="Get all Widget types details for specified Bundle (getBundleWidgetTypes)",
notes="Returns an array of Widget Type Details objects that belong to specified Widget Bundle."+WIDGET_TYPE_DETAILS_DESCRIPTION+" "+SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
privatestaticfinalStringWIDGET_BUNDLE_DESCRIPTION="Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. ";
@ApiOperation(value="Create Or Update Widget Bundle (saveWidgetsBundle)",
notes="Create or update the Widget Bundle. "+WIDGET_BUNDLE_DESCRIPTION+" "+
"When creating the bundle, platform generates Widget Bundle Id as "+UUID_WIKI_LINK+
"The newly created Widget Bundle Id will be present in the response. "+
"Specify existing Widget Bundle id to update the Widget Bundle. "+
"Referencing non-existing Widget Bundle Id will cause 'Not Found' error."+
"\n\nWidget Bundle alias is unique in the scope of tenant. "+
"Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority."+
"Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity."+
@ApiOperation(value="Get all Widget Bundles (getWidgetsBundles)",
notes="Returns an array of Widget Bundle objects that are available for current user."+WIDGET_BUNDLE_DESCRIPTION+" "+AVAILABLE_FOR_ANY_AUTHORIZED_USER)
log.info("[{}][{}][{}] Session is opened from address: {}",sessionRef.getSecurityCtx().getTenantId(),externalSessionId,session.getId(),session.getRemoteAddress());
}catch(InvalidParameterExceptione){
log.warn("[{}] Failed to start session",session.getId(),e);
sessionMd.sendMsg("{\"subscriptionId\":"+subscriptionId+", \"errorCode\":"+ThingsboardErrorCode.TOO_MANY_UPDATES.getErrorCode()+", \"errorMsg\":\"Too many updates!\"}");
}
return;
}else{
log.debug("[{}][{}][{}] Session is no longer blacklisted.",sessionRef.getSecurityCtx().getTenantId(),sessionRef.getSecurityCtx().getId(),externalId);
mapper.writeValue(response.getWriter(),ThingsboardErrorResponse.of("Invalid username or password",ThingsboardErrorCode.AUTHENTICATION,HttpStatus.UNAUTHORIZED));
mapper.writeValue(response.getWriter(),ThingsboardErrorResponse.of("User account is not active",ThingsboardErrorCode.AUTHENTICATION,HttpStatus.UNAUTHORIZED));
mapper.writeValue(response.getWriter(),ThingsboardErrorResponse.of("User account is locked due to security policy",ThingsboardErrorCode.AUTHENTICATION,HttpStatus.UNAUTHORIZED));
mapper.writeValue(response.getWriter(),ThingsboardErrorResponse.of("Token has expired",ThingsboardErrorCode.JWT_TOKEN_EXPIRED,HttpStatus.UNAUTHORIZED));