0
votes

I'm looking for examples to control Worklight appclications via REST API for automation. What I need is a method to disable and enable specific application from command line.

I've found "HTTP Interface of the production server" on the IBM Worklight Information Center, but it doesn't work.

For exapmle, I sent a GET request to:

<WorklightServerURL>/worklight/console/api/getApplications

In return I got:

Error 404: Could not find resource for relative : /getApplications of full path: /worklight/console/api/getApplications".

Looking into the Worklight Console interactions using Chrome developer tool, disabling application request generates:

<WorklightServerURL>/worklight/console/api/applications/setAccessRule/17

Which is not consistent with the IBM Worklight Information Center...

1

1 Answers

1
votes

This looks to be a documentation defect, where (in this specific case):

http://myhost:port/console/api/{Action}

Should be

http://myhost:port/console/api/applications/{Action}

For example:

http://myworklightserver:8080/console/api/applications/all
http://myworklightserver:8080/console/api/applications/get/testapp

I have opened a documentation defect to update the Console API Requests section. Thanks.


As for setAccessRule,

  • The API request structure is: http://myworklightserver:8080/console/api/applications/setAccessRule
  • The parameters are:
    • gadgetAppId (Required. You can find this in the database)
    • action (Required. delete | notify | block)
    • message (Required)
    • downloadLink (Optional)

Note that you are linking to the Worklight 5.0.5 Information Center; the fixes will appear in the Worklight 5.0.6 and 6.0 Information Center pages.

In Worklight 6.0 the port has changed to "10080", and a context root section exists before "/console".

http://myworklightserver:10080/mycontext/console/api/applications/all