|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
REST API post mqsc file to configure queues |
« View previous topic :: View next topic » |
Author |
Message
|
stravze |
Posted: Fri Sep 22, 2023 1:44 am Post subject: REST API post mqsc file to configure queues |
|
|
Newbie
Joined: 22 Sep 2023 Posts: 3
|
Hello
Is it possible to use an exported mqsc file, and post that file via the API to configure / amend and update channels / queue's etc ?
Sorry totally newbie to this |
|
Back to top |
|
 |
hughson |
Posted: Fri Sep 22, 2023 2:23 am Post subject: Re: REST API post mqsc file to configure queues |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
stravze wrote: |
Hello
Is it possible to use an exported mqsc file, and post that file via the API to configure / amend and update channels / queue's etc ?
Sorry totally newbie to this |
Yes, sort of. Not an exported MQSC file exactly as-is. But MQSC commands with some extra wrapping. Here's a quick example.
Make a file like this:-
Code: |
{
"type": "runCommand",
"parameters": {
"command": "DISPLAY CHANNEL(MQGEM201.SVRCONN) ALL"
}
} |
Then call the REST API providing this file, something like this:
Code: |
curl -X POST -H "Content-Type: application/json" -d "@mqsc.json" http://localhost:9080/ibmmq/rest/v1/admin/action/qmgr/MQG1/mqsc |
In this example my file is called mqsc.json - the @ symbol says it's a file instead of inline JSON, my qmgr is called MQG1, and this web server is running on my local machine, e.g. localhost. You may have differences in your setup.
In this case the output comes back in the familiar, traditional, hard to parse with a computer program, MQSC output.
Alternatively, you can get the output back in JSON format, from MQ V9.1.x
File contents now look like this:
Code: |
{
"type": "runCommandJSON",
"command": "display",
"qualifier": "channel",
"name": "MQGEM201.SVRCONN",
"responseParameters": ["all"]
} |
Differences between the two modes include:-
- First mode - can literally issue ANY MQSC command since it is just passed on through to the command server.
- Second mode - have to wait until MQ implements the "JSON spelling" of the command before it is supported.
- First mode - Easy for a human to read
- Second mode - Not so easy for a human to read
- First mode - Very difficult to parse programmatically
- Second mode - Easy to parse programmatically
More details in IBM Docs here: POST - plain text MQSC command
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
stravze |
Posted: Fri Sep 22, 2023 3:31 am Post subject: |
|
|
Newbie
Joined: 22 Sep 2023 Posts: 3
|
Thank you this is excellent |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|