ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » REST API post mqsc file to configure queues

Post new topic  Reply to topic
 REST API post mqsc file to configure queues « View previous topic :: View next topic » 
Author Message
stravze
PostPosted: Fri Sep 22, 2023 1:44 am    Post subject: REST API post mqsc file to configure queues Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Fri Sep 22, 2023 2:23 am    Post subject: Re: REST API post mqsc file to configure queues Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
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
View user's profile Send private message Visit poster's website
stravze
PostPosted: Fri Sep 22, 2023 3:31 am    Post subject: Reply with quote

Newbie

Joined: 22 Sep 2023
Posts: 3

Thank you this is excellent
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » REST API post mqsc file to configure queues
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.