Skip to content

Latest commit

 

History

History
153 lines (114 loc) · 7 KB

terms_of_service.md

File metadata and controls

153 lines (114 loc) · 7 KB

Terms of Service

Terms of Service allows Box Admins to configure a custom Terms of Service for end users to accept/re-accept/decline for custom applications

Create a Terms of Service

A terms of service can be created in an enterprise. Please note that only two can be created. One external and one managed. If a terms of service already exists please use the update call to change the current terms of service.

You can create a custom terms of service by calling create(BoxAPIConnection api, BoxTermsOfService.TermsOfServiceStatus status, BoxTermsOfService.TermsOfServiceType type, String text).

BoxTermsOfService.Info newTOS = BoxTermsOfService.create(
    api,
    BoxTermsOfService.TermsOfServiceStatus.ENABLED,
    BoxTermsOfService.TermsOfServiceType.EXTERNAL,
    "Terms of Service..."
);

Edit a Terms of Service

You can update a terms of service status and text after you have created them by calling updateInfo(BoxTermsOfService.Info fieldsToUpdate)

BoxTermsOfService termsOfService = new BoxTermsOfService(api, "tos-id");
BoxTermsOfService.Info termsOfServiceInfo = termsOfService.new Info();
termsOfServiceInfo.setStatus(BoxTermsOfService.TermsOfServiceStatus.DISABLED);
termsOfServiceInfo.setText("New Terms of Service Text");
termsOfService.updateInfo(termsOfService);

Get a Terms of Service

You can retrieve a terms of service by providing the ID and calling getInfo().

BoxTermsOfService termsOfService = new BoxTermsOfService(api, "tos-id");
BoxTermsOfService.Info tosInfo = termsOfService.getInfo();

Get All Terms of Services

You can also retrieve all terms of service in your enterprise by calling getAllTermsOfServices(BoxAPIConnection api). This will return an iterable that will page through all of the enterprises terms of services.

List<BoxTermsOfService.Info> termsOfServices = BoxTermsOfService.getAllTermsOfServices(api);
for(BoxTermsOfService.Info termsOfServiceInfo : termsOfServices){
    // Do something with the terms of service.
}

You can also filter by managed or external terms of service by calling getAllTermsOfServices(BoxAPIConnection api, BoxTermsOfService.TermsOfServiceType type).

Accept or Decline a Terms of Service for New User

For new users you can accept or decline a terms of service by calling create(BoxAPIConnection api, String tosID, Boolean accepted, String userID)

BoxTermsOfService.Info newUserStatus = BoxTermsOfServiceUserStatus.create(api, "tos-id", true, "user-id");

You can only create a new user status on a terms of service if the user has never accepted/declined a terms of service. If they have then you will need to make the update call.

Accept or Decline a Terms of Service for Existing User

For an existing user you can accept or decline a terms of service by calling updateInfo(BoxTermsOfService.Info fieldsToUpdate).

BoxTermsOfServiceUserStatus tosUserStatus = new BoxTermsOfServiceUserStatus(api, "tos-user-status-id");
BoxTermOfServiceUserStatus.Info tosUserStatusInfo = tosUserStatus.new Info();
tosUserStatusInfo.setStatus(newStatus);
tosUserStatus.updateInfo(tosUSerStatusInfo);

Get User Status on a Terms of Service

You can retrieve the terms of service status for a user by calling getInfo(BoxAPIConnection api, String tosID, String userID)

List<BoxTermsOfServiceUserStatus.Info> tosUserStatusInfo = BoxTermsOfServiceUserStatus.getInfo(api, "tos-id", "user-id");
for(BoxTermsOfServiceUserStatus.Info info : toUserStatusInfo){
    // Do something with the user status on terms of service.
}

Alternatively you can get the user status by the ID of the terms of service by calling getInfo(BoxAPIConnection api, String tosID).

List<BoxTermsOfServiceUserStatus.Info> tosUserStatusInfo = BoxTermsOfServiceUserStatus.getInfo(api, "tos-id");
for(BoxTermsOfServiceUserStatus.Info info : toUserStatusInfo){
    // Do something with the user status on terms of service.
}