To get a list of all supported commands, please use the Swagger UI to login and try a command. You can access it at:
http://<Workgroup Server IP:Rest API port>/rest/v1/api-docs
For example if your workgroup server is on 172.16.31.20, and the Rest API listener is using port 8019. You can access the Swagger UI at:
http://172.16.31.20:8019/rest/v1/api-docs?url=/rest/v1/openapi.json#/ for WGS objects
http://172.16.31.20:8019/wsm/v1/api-docs?url=/wsm/v1/openapi.json#/ for WSM objects
To generate OpenAPI.json, choose one of the following methods:
- Use the Swagger UI. Click the /rest/v1/openapi.json link, as shown below.
- Use a Curl command:
curl -i -u Admin:admin -X GET "http://<host>:<port>/rest/v1/openapi.json"
You can also use the Swagger UI to display the curl commands you can use for individual objects. For a breakdown of examples by product, see REST API. (A collection of examples is provided. It is not an exhaustive list.)
IBM MQ examples
Below are a few basic REST API examples:
List nodes:
curl -i -u Admin:admin -X GET "http://172.16.31.20:8019/rest/v1/nodes"
List remote queue managers:
curl -i -u Admin:admin -X GET "http://172.16.31.20:8019/rest/v1/remote-qmgrs"
Add a remote QMGR:
curl -i -u Admin:admin -X POST "http://172.16.31.20:8019/rest/v1/remote-qmgrs" -H "Content-Type: application/json" -d "{\"wgsName\":\"MQM\",\"nodeName\":\"DOCKER\",\"qmgrName\":\"TQM53\",\"general\":{\"connectUser\":\"nastel\",\"connectPassword\":\"Nastel@12345678\"},\"communication\":{\"connectionName\":\"172.16.31.121(1434)\",\"cmdQName\":\"SYSTEM.ADMIN.COMMAND.QUEUE\",\"channelName\":\"NAVIGATOR.SVRCONN\",\"cmdConvert\":\"No\"}}"
This is an example of adding a queue manager named TQM53, and a connection manager instance DOCKER.
Delete remote queue manager:
curl -i -u Admin:admin -X DELETE "http://172.16.31.20:8019/rest/v1/remote-qmgrs/DOCKER/TQM2"
This is an example of deleting a queue manager named TQM2 from the connection manager instance DOCKER.
Display attributes of a queue:
This is an example of listing all the static and runtime attributes of a queue named STYX.TEST.QL, on Queue Manager STYX, Node RDQM-1.
curl -X GET "http://172.16.31.20:8019/rest/v1/ibmmq/queues?attributes=%2A&nodeName=RDQM-1&qmgrName=STYX&type=Local&queueName=STYX.TEST.QL" -H "accept: application/json" -H "Authorization: Basic QWRtaW46YWRtaW4="
Display a specific attribute of a queue:
This is an example of listing the Current Queue Depth of a queue named STYX.TEST.QL, on Queue Manager STYX, Node RDQM-1. Please note that you must provide the full path to the attribute(s).
curl -X GET "http://172.16.31.20:8019/rest/v1/ibmmq/queues?attributes=state.curQDepth&nodeName=RDQM-1&qmgrName=STYX&type=Local&queueName=STYX.TEST.QL" -H "accept: application/json" -H "Authorization: Basic QWRtaW46YWRtaW4="
Display multiple attributes of a queue:
This is an example of listing the Usage, Current Queue Depth, and Max Queue Depth of STYX.TEST.QL, on Queue Manager STYX, Node RDQM-1.
curl -X GET "http://172.16.31.20:8019/rest/v1/ibmmq/queues/RDQM-1/STYX/Local/STYX.TEST.QL?attributes=general.usage%2Cstate.curQDepth%2Cextended.maxDepth" -H "accept: application/json" -H "Authorization: Basic QWRtaW46YWRtaW4="
Kafka examples
Below are a few basic Kafka examples:
List Kafka remote managers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/kafka/remote-mgrs"
List Kafka topics:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/kafka/topics"
Get Kafka topic xxx on node CMKafka and cluster localhost:9095 all attributes:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/kafka/topics/CMKafka/localhost:9095/xxx?attributes=%2A"
List Kafka connects:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/kafka/connects"
Get Kafka connect TestConnect on node CMKafka, cluster localhost:9095 and connect instance Connector1 general and state sections attributes:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/kafka/connects/CMKafka/localhost:9095/Connector1/TestConnect?attributes=general.*,state.*"
TIBCO EMS examples
Below are a few basic TIBCO EMS examples:
List EMS remote managers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ems/remote-mgrs"
List EMS managers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ems/managers"
Get EMS manager tcp://127.0.0.1:7222 on node EMS-SERVER ACLs:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ems/managers/EMS-SERVER/tcp:%2F%2F127.0.0.1:7222/acls"
List EMS queues on node EMS-SERVER and manager tcp://127.0.0.1:7222:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ems/queues?nodeName=EMS-SERVER&managerName=tcp:%2F%2F127.0.0.1:7222"
Get EMS queue sample on node EMS-SERVER and manager tcp://127.0.0.1:7222 all attributes:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ems/queues/EMS-SERVER/tcp:%2F%2F127.0.0.1:7222/sample?attributes=%2A"
IBM IIB examples
Below are a few basic IBM IIB examples:
List IIB remote managers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/aceiib/remote-mgrs"
List IIB servers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/iib/servers"
Get IIB applications on node CMACE, manager NodeIIB and server Server1:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/iib/applications?wgsNodeName=CMACE&wgsMgrName=NodeIIB&serverName=Server1"
Get IIB application App on node CMACE, manager NodeIIB and server Server1 all attributes:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/iib/applications/CMACE/NodeIIB/Server1/App?attributes=%2A"
IBM ACE examples
Below are a few basic IBM ACE examples:
List IBM ACE remote managers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/aceiib/remote-mgrs"
List ACE servers:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ace/servers"
Get ACE applications on node CMACE, manager NodeACE and server Server1:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ace/applications?wgsNodeName=CMACE&wgsMgrName=NodeACE&serverName=Server1"
Get ACE application App on node CMACE, manager NodeACE and server Server1 active, descriptive and state sections attributes:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/rest/v1/ace/applications/CMACE/NodeACE/Server1/App?attributes=active.*,descriptive.*,state.*"
Navigator Security Manager examples
Below are a few basic Navigator Security Manager examples:
List server groups:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/server-groups"
List object groups:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/object-groups"
List object types:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/object-types"
List features:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/features"
List roles:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/roles"
List user groups:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/user-groups"
List users:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/users"
Read user full information by ID:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/users/5"
Create new user Tom with group Developers:
curl -i -u Admin:admin -X POST "http://192.168.88.233:8019/wsm/v1/users" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"userName\":\"tom\",\"description\":\"Tom Developer\",\"locked\":false,\"disabled\":false,\"userGroupNames\":[\"Developers\"]}"
Delete user by ID:
curl -i -u Admin:admin -X DELETE "http://192.168.88.233:8019/wsm/v1/users/8"
List audit levels:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/audit-levels"
List configured audits:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/audits"
List configured trusts:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/trusts"
List last WSM audit records with limit 10:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/wsm-audits?limit=10"
List last WGS audit records with limit 10:
curl -i -u Admin:admin -X GET "http://192.168.88.233:8019/wsm/v1/wgs-audits?limit=10"
REST API with Oauth2
Below is information on how to setup and utilize REST API with Oauth2.
Setup
- Enable OAuth2 Authentication in the workgroup server properties as seen below:
- Request a token. You will get two tokens, the access_token and refresh_token. You need to send access_token in the curl header. Send a command like the following to request a token:
curl -k -X POST "http://172.16.31.20:8019/auth/token" -H "accept: */*" -H "Content-Type: application/json" -d "{\"client_id\":\"nastel\",\"client_secret\":\"nastel\",\"grant_type\":\"password\",\"username\":\"Administrator\",\"password\":\"venkat123\"}"
In this example the username is "Administrator" and the password is "venkat123" (located at the end of the json string). The response appears as follows:{"scope":"","token_type":"Bearer","expires_in":1800,"access_token":"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNUU0iLCJzdWIiOiJBZG1pbmlzdHJhdG9yIiwianRpIjoiYjUyMWNkOGMtNTQxMC00NmFiLWJhOTMtMzE0ZWJlMGFlN2ZlIiwiaWF0IjoxNjEyODQ1OTU2LCJleHAiOjE2MTI4NDc3NTYsInJlZnJlc2hUb2tlbklkIjoiOWYxNDhiMzktOWFmOC00NWJiLTg1MzEtNjFmZjExY2ZhZjc1In0.PAAnLbtjLeljC0Eh9-6nnS6jGeJYbBoRP0orAv4nPQ8","refresh_token":"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNUU0iLCJzdWIiOiJBZG1pbmlzdHJhdG9yIiwianRpIjoiOWYxNDhiMzktOWFmOC00NWJiLTg1MzEtNjFmZjExY2ZhZjc1IiwiaWF0IjoxNjEyODQ1OTU2LCJleHAiOjE2MTM3MDk5NTYsImNsaWVudElkIjoibmFzdGVsIiwiY2xpZW50U2VjdXJlIjoibmFzdGVsIn0.a4P8grwUiTAA1b-oz-0d_lJqukVEceblkJ4olho-ytQ"}
Use this token in future commands.
List WGS attributes
curl -X GET "http://172.16.31.20:8019/rest/v1/" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNUU0iLCJzdWIiOiJBZG1pbmlzdHJhdG9yIiwianRpIjoiYjUyMWNkOGMtNTQxMC00NmFiLWJhOTMtMzE0ZWJlMGFlN2ZlIiwiaWF0IjoxNjEyODQ1OTU2LCJleHAiOjE2MTI4NDc3NTYsInJlZnJlc2hUb2tlbklkIjoiOWYxNDhiMzktOWFmOC00NWJiLTg1MzEtNjFmZjExY2ZhZjc1In0.PAAnLbtjLeljC0Eh9-6nnS6jGeJYbBoRP0orAv4nPQ8"
Response:
{
"version" : "10.4.2.4.2",
"serviceName" : "WGS",
"appName" : "WGS",
"wgsName" : "MQM",
"apwmqDbInfo" : "DBMS: Oracle APWMQ_DB_VERSION: 45 (Expected: 45)",
"permitsDbInfo" : "DBMS: Oracle PERMV3_DB_VERSION: 99 (Expected: 99)",
"servicesURL" : "http://172.16.31.129:8019/rest/v1/services",
"swaggerUiURL" : "http://172.16.31.129:8019/rest/v1/api-docs"
}
List basic node information for ISERIES
curl -X GET "http://172.16.31.129:8019/rest/v1/" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNUU0iLCJzdWIiOiJBZG1pbiIsImp0aSI6ImRmOGQ5ZThkLWEzYzgtNGU3Yi05ZGE5LWVhMTkxM2RhYjgwMCIsImlhdCI6MTY3MTE4NDU5MCwiZXhwIjoxNjcxMjAyNTkwLCJyZWZyZXNoVG9rZW5JZCI6IjM0MWE0ZWM3LThkOWItNDg2YS1hNzFjLTlmZmQ2MjhmMTQzNCJ9._x_5Sn2hAogwYeMMCllusNLXWHxxA7GkK8z8rg-uhSA"
Response:
{
"wgsName" : "MQM",
"name" : "ISERIES",
"type" : "Local Agent"
}
List detailed node information for ISERIES
curl -X GET "http://172.16.31.20:8019/rest/v1/nodes/ISERIES?attributes=%2A" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNUU0iLCJzdWIiOiJBZG1pbmlzdHJhdG9yIiwianRpIjoiYjUyMWNkOGMtNTQxMC00NmFiLWJhOTMtMzE0ZWJlMGFlN2ZlIiwiaWF0IjoxNjEyODQ1OTU2LCJleHAiOjE2MTI4NDc3NTYsInJlZnJlc2hUb2tlbklkIjoiOWYxNDhiMzktOWFmOC00NWJiLTg1MzEtNjFmZjExY2ZhZjc1In0.PAAnLbtjLeljC0Eh9-6nnS6jGeJYbBoRP0orAv4nPQ8"
Response:
{
"wgsName" : "MQM",
"name" : "ISERIES",
"type" : "Local Agent",
"identity" : {
"useDns" : "No",
"hostName" : "",
"netAddress" : "129.40.95.121",
"portNumber" : 5010,
"version" : "6.7.0003",
"platform" : "OS/400",
"description" : ""
},
"discovery" : {
"heartBeat" : 1,
"discoveryInterval" : 720,
"refreshInterval" : 30,
"commandTimeout" : 90,
"pendingCommandLimit" : 5000,
"useNewRefresh" : "On",
"nameListDiscover" : "Off",
"ping" : 0,
"dnsName" : ""
},
"extended" : {
"traceAgent" : "Disabled",
"uidToUpper" : "Off",
"maxWaitTime" : 0,
"tcpQueueLimit" : 0,
"tcpRetryCount" : 0,
"bufferSize" : 0,
"tcpNoDelay" : "Off",
"reuseAddr" : "Off"
},
"mask" : {
"qmgr" : "*",
"aliasQueue" : "*",
"localQueue" : "*",
"modelQueue" : "*",
"remoteQueue" : "*",
"channel" : "*",
"client" : "*",
"listener" : "*",
"process" : "*",
"service" : "*",
"nameList" : "*",
"authInfo" : "*",
"clusterQMgr" : "*",
"topic" : "*",
"subscription" : "*"
},
"qmgr" : {
"logMethod" : null,
"logPath" : "",
"primaryLogs" : 0,
"secondaryLogs" : 0,
"logFileSize" : 0,
"logBufferSize" : 0
},
"state" : {
"lastUpdated" : 1611613707000,
"objectState" : "Unknown",
"managed" : "Enabled",
"authorization" : "Off",
"eventCounter" : 0,
"lastAction" : 10129,
"lastEventTime" : 0,
"osInformation" : "",
"cpuCount" : 4,
"mipsCount" : 0
},
"jobs" : {
"totalJobCount" : 0,
"scheduledJobCount" : 0,
"canceledJobCount" : 0,
"successJobCount" : 0,
"failedJobCount" : 0,
"readyJobCount" : 0,
"pendingJobCount" : 0,
"jobIds" : [ ]
},
"customProperties" : { }
}