App Version Access Rule (PUT)
Sets the access rule of a specific app version.
Description
The access rule specifies the behavior when a user accesses the application on the device.
This transaction can run synchronously or asynchronously. If processed asynchronously, the REST service returns before the transaction is completed. In this case, you can query the transaction result later with the transaction REST service.
Roles
Users in the following roles are authorized to perform this operation:
- worklightadmin
- worklightdeployer
- worklightoperator
Method
PUT
Path
/management-apis/1.0/runtimes/runtime-name/applications/application-name/application-env/application-version/accessRule
Example
https://www.example.com/worklightadmin/management-apis/1.0/runtimes/myruntime/applications/myapplication/android/1.0/accessRule?async=false&locale=de_DE
Path Parameters
- runtime-name
- The name of the runtime. This is the context root of the runtime web application, without the leading slash.
- application-name
- The name of the application.
- application-env
- The application environment.
- application-version
- The application version number.
Query Parameters
Query parameters are optional.
- async
- Whether the transaction is processed synchronously or asynchronously. Allowed values are true and false. The default is synchronous processing.
- locale
- The locale used for error messages.
Consumes
application/json, application/xml, text/xml
Produces
application/json, application/xml, text/xml
Payload
JSON Example
{
"action" : "NOTIFY",
"downloadLink" : "ibmappctr://myapp",
"message" : "Please update!",
"multiLanguageMessage" : [
{
"locale" : "de",
"message" : "Bitte updaten!",
},
...
],
}
XML Example
<?xml version="1.0" encoding="UTF-8"?>
<accessrule
action="NOTIFY"
downloadLink="ibmappctr://myapp"
message="Please update!">
<multiLanguageMessage>
<localizedMessage
locale="de"
message="Bitte updaten!"/>
...
</multiLanguageMessage>
</accessrule>
Payload Properties
The payload has the following properties:- action
- The action to be performed. It can have the following values: NOTIFY (notify the user of some message), BLOCK (block the execution the application), DELETE (remove the access rule).
- downloadLink
- An optional link displayed with the message where to download a new version of the application.
- message
- The message to be displayed when the action is NOTIFY or BLOCK.
- multiLanguageMessage
- Messages in additional languages
The multilanguage message has the following properties:
- locale
- The locale of the message.
- message
- The translated message.
Response
The metadata of the app version and its access rule.
JSON Example
{
"ok" : false,
"productVersion" : "7.1.0",
"transaction" : {
"appServerId" : "Tomcat",
"description" : {
"action" : "NOTIFY",
"appVersion" : {
"applicationName" : "myapplication",
"environment" : "android",
"version" : "1.0",
},
"createdAtDate" : "2014-02-13T00:18:36.979Z",
"message" : "This version is no longer supported.",
},
"errors" : [
{
"details" : "An internal error occured.",
},
...
],
"id" : 1,
"project" : {
"name" : "myproject",
},
"status" : "FAILURE",
"timeCreated" : "2014-04-13T00:18:36.979Z",
"timeUpdated" : "2014-04-14T00:18:36.979Z",
"type" : "SET_APPLICATION_ENV_VERSION_ACCESS_RULE",
"userName" : "demouser",
},
}
XML Example
<?xml version="1.0" encoding="UTF-8"?>
<set-appversion-accessrule-result
ok="false"
productVersion="7.1.0">
<transaction
appServerId="Tomcat"
id="1"
status="FAILURE"
timeCreated="2014-04-13T00:18:36.979Z"
timeUpdated="2014-04-14T00:18:36.979Z"
type="SET_APPLICATION_ENV_VERSION_ACCESS_RULE"
userName="demouser">
<description
action="NOTIFY"
createdAtDate="2014-02-13T00:18:36.979Z"
message="This version is no longer supported.">
<appVersion
applicationName="myapplication"
environment="android"
version="1.0"/>
</description>
<errors>
<error details="An internal error occured."/>
...
</errors>
<project name="myproject"/>
</transaction>
</set-appversion-accessrule-result>
Response Properties
The response has the following properties:
- ok
- Whether the transaction was successful.
- productVersion
- The exact product version.
- transaction
- The details of the transaction.
The transaction has the following properties:
- appServerId
- The id of the web application server.
- description
- The details of the application.
- errors
- The errors occurred during the transaction.
- id
- The id of the transaction.
- project
- The current project.
- status
- The state of the transaction: PENDING, PREPARING, COMMITTING, REJECTING, SUCCESS, FAILURE, CANCELED. Synchronous transactions can have the state SUCCESS and FAILURE. Asynchronous transactions can also have the other states.
- timeCreated
- The date in ISO 8601 format when the adapter was created.
- timeUpdated
- The date in ISO 8601 format when the adapter was updated.
- type
- The type of the transaction, here always SET_APPLICATION_ENV_VERSION_ACCESS_RULE.
- userName
- The user that initiated the transaction.
The description has the following properties:
- action
- The action to be done when a disabled app version is accessed. Possible values are: NOTIFY, BLOCK, NA, DELETE.
- appVersion
- The corresponding app version
- createdAtDate
- The date in ISO 8601 format when the app version access rule was created.
- downloadLink
- The download link where to obtain a new version of the application.
- message
- The message to be displayed when a disabled app version is accessed.
The app version has the following properties:
- applicationName
- The name of the application.
- environment
- The environment of the application.
- version
- The version of the application.
The error has the following properties:
- details
- The main error message.
The project has the following properties:
- name
- The name of the project, which is the context root of the runtime.
Errors
400The payload is invalid.
403 The user is not authorized to call this service.
404 The corresponding runtime or the app version is not found.
500 An internal error occurred.