{"id":825,"date":"2020-12-10T13:19:45","date_gmt":"2020-12-10T13:19:45","guid":{"rendered":"https:\/\/marketaylor.synology.me\/?p=825"},"modified":"2020-12-11T10:27:19","modified_gmt":"2020-12-11T10:27:19","slug":"save-mq-configuration-as-json","status":"publish","type":"post","link":"https:\/\/marketaylor.synology.me\/?p=825","title":{"rendered":"Save MQ configuration as JSON"},"content":{"rendered":"\n<p>A requirement I&#8217;ve seen a couple of times recently asked how to save an MQ queue manager&#8217;s configuration in a different format than MQSC. This short post shows one way to do that.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>The <a rel=\"noreferrer noopener\" aria-label=\"dmpmqcfg  (opens in a new tab)\" href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/SSFKSJ_9.2.0\/com.ibm.mq.ref.adm.doc\/q083160_.htm\" target=\"_blank\">dmpmqcfg <\/a>program is the standard product-provided solution for backing up all the object definitions. It&#8217;s got a number of options including the ability to generate the output in a fashion suitable for replay &#8211; you can use its output as input to runmqsc and regenerate the original objects. But sometimes the purpose of the recording might be for analysis or comparisons. While the options in dmpmqcfg (for example one-line output) may help with that, some tools might find be easier to work with a different format than MQSC.<\/p>\n\n\n\n<p>The obvious answer here (and the one that we have told people) is to use MQ&#8217;s <a rel=\"noreferrer noopener\" aria-label=\"REST Admin API (opens in a new tab)\" href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/SSFKSJ_9.2.0\/com.ibm.mq.ref.adm.doc\/q133340_.html\" target=\"_blank\">REST Admin API<\/a>. Putting calls to that in a script will give what you are looking for.<\/p>\n\n\n\n<p>And as an exercise, I wrote such a script this morning. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dmpmqcfg.sh -m QM1 -s localhost -u metaylor -c &lt;passw0rd&gt; <\/pre>\n\n\n\n<p>which gives output as a set of JSON objects such as<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n   \"queueManager\": \"QM1\",\n   \"objectType\": \"QMGR\",\n   \"objects\": [\n     {\n       \"acctcono\": \"DISABLED\",\n       \"acctint\": 1800,\n       \"acctmqi\": \"OFF\",\n       \"acctq\": \"OFF\",\n       \"activrec\": \"MSG\",\n       \"actvcono\": \"DISABLED\",\n       \"actvtrc\": \"OFF\",\n...\n}\n{\n   \"queueManager\": \"QM1\",\n   \"objectType\": \"POLICY\",\n   \"objects\": [\n     {\n       \"encalg\": \"AES256\",\n       \"enforce\": \"YES\",\n       \"keyreuse\": \"DISABLED\",\n       \"policy\": \"X\",\n       \"recip\": [\n         \"CN=M...\"\n       ],\n       \"signalg\": \"MD5\"\n     }\n   ]\n }<\/pre>\n\n\n\n<p>It is a bash script, and relies on <strong>curl <\/strong>and <strong>jq<\/strong>. Those two commands do exist on Windows so it should be adaptable to run there if you wanted. The use of jq is optional, but I felt a bit of transformation gave a slightly better output. For example it now includes the queue manager name in each set of objects.<\/p>\n\n\n\n<p>The full (but short) script can be found as<a href=\"https:\/\/gist.github.com\/ibmmqmet\/50438e972d968411c549c9c63fb13afb\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"> a gist<\/a> on github.com. Feel free to adapt it for your own reports.<\/p>\n<p class=\"last-modified\" style=\"border:1px solid;padding: 10px;\">This post was last updated on December 11th, 2020 at 10:27 am<\/p>","protected":false},"excerpt":{"rendered":"<p>A requirement I&#8217;ve seen a couple of times recently asked how to save an MQ queue manager&#8217;s configuration in a different format than MQSC. This short post shows one way to do that. This post was last updated on December 11th, 2020 at 10:27 am<\/p>\n","protected":false},"author":1,"featured_media":830,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[96,35,38,20],"class_list":["post-825","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mq","tag-dmpmqcfg","tag-ibmmq","tag-json","tag-mqseries"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Save MQ configuration as JSON - Mark Taylor&#039;s Blog<\/title>\n<meta name=\"description\" content=\"Use the MQ REST Admin API to save a queue manager&#039;s configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/marketaylor.synology.me\/?p=825\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Save MQ configuration as JSON - Mark Taylor&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Use the MQ REST Admin API to save a queue manager&#039;s configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/marketaylor.synology.me\/?p=825\" \/>\n<meta property=\"og:site_name\" content=\"Mark Taylor&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-10T13:19:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-11T10:27:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png\" \/>\n\t<meta property=\"og:image:width\" content=\"128\" \/>\n\t<meta property=\"og:image:height\" content=\"51\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mark\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@marketaylor\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825\"},\"author\":{\"name\":\"Mark\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/#\\\/schema\\\/person\\\/2d6f4113ff54187023e20c20186bbb3c\"},\"headline\":\"Save MQ configuration as JSON\",\"datePublished\":\"2020-12-10T13:19:45+00:00\",\"dateModified\":\"2020-12-11T10:27:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825\"},\"wordCount\":270,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/marketaylor.synology.me\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/json-e1607682376243.png\",\"keywords\":[\"dmpmqcfg\",\"ibmmq\",\"json\",\"mqseries\"],\"articleSection\":[\"IBM MQ\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825\",\"url\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825\",\"name\":\"Save MQ configuration as JSON - Mark Taylor&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/marketaylor.synology.me\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/json-e1607682376243.png\",\"datePublished\":\"2020-12-10T13:19:45+00:00\",\"dateModified\":\"2020-12-11T10:27:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/#\\\/schema\\\/person\\\/2d6f4113ff54187023e20c20186bbb3c\"},\"description\":\"Use the MQ REST Admin API to save a queue manager's configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#primaryimage\",\"url\":\"https:\\\/\\\/marketaylor.synology.me\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/json-e1607682376243.png\",\"contentUrl\":\"https:\\\/\\\/marketaylor.synology.me\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/json-e1607682376243.png\",\"width\":128,\"height\":51,\"caption\":\"JSON\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/?p=825#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/marketaylor.synology.me\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Save MQ configuration as JSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/#website\",\"url\":\"https:\\\/\\\/marketaylor.synology.me\\\/\",\"name\":\"Mark Taylor&#039;s Blog\",\"description\":\"Messaging, Music and Moving Around\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/marketaylor.synology.me\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/marketaylor.synology.me\\\/#\\\/schema\\\/person\\\/2d6f4113ff54187023e20c20186bbb3c\",\"name\":\"Mark\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g\",\"caption\":\"Mark\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/marketaylor\"],\"url\":\"https:\\\/\\\/marketaylor.synology.me\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Save MQ configuration as JSON - Mark Taylor&#039;s Blog","description":"Use the MQ REST Admin API to save a queue manager's configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/marketaylor.synology.me\/?p=825","og_locale":"en_GB","og_type":"article","og_title":"Save MQ configuration as JSON - Mark Taylor&#039;s Blog","og_description":"Use the MQ REST Admin API to save a queue manager's configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.","og_url":"https:\/\/marketaylor.synology.me\/?p=825","og_site_name":"Mark Taylor&#039;s Blog","article_published_time":"2020-12-10T13:19:45+00:00","article_modified_time":"2020-12-11T10:27:19+00:00","og_image":[{"width":128,"height":51,"url":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","type":"image\/png"}],"author":"Mark","twitter_card":"summary_large_image","twitter_creator":"@marketaylor","twitter_misc":{"Written by":"Mark","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/marketaylor.synology.me\/?p=825#article","isPartOf":{"@id":"https:\/\/marketaylor.synology.me\/?p=825"},"author":{"name":"Mark","@id":"https:\/\/marketaylor.synology.me\/#\/schema\/person\/2d6f4113ff54187023e20c20186bbb3c"},"headline":"Save MQ configuration as JSON","datePublished":"2020-12-10T13:19:45+00:00","dateModified":"2020-12-11T10:27:19+00:00","mainEntityOfPage":{"@id":"https:\/\/marketaylor.synology.me\/?p=825"},"wordCount":270,"commentCount":0,"image":{"@id":"https:\/\/marketaylor.synology.me\/?p=825#primaryimage"},"thumbnailUrl":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","keywords":["dmpmqcfg","ibmmq","json","mqseries"],"articleSection":["IBM MQ"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/marketaylor.synology.me\/?p=825#respond"]}]},{"@type":"WebPage","@id":"https:\/\/marketaylor.synology.me\/?p=825","url":"https:\/\/marketaylor.synology.me\/?p=825","name":"Save MQ configuration as JSON - Mark Taylor&#039;s Blog","isPartOf":{"@id":"https:\/\/marketaylor.synology.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/marketaylor.synology.me\/?p=825#primaryimage"},"image":{"@id":"https:\/\/marketaylor.synology.me\/?p=825#primaryimage"},"thumbnailUrl":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","datePublished":"2020-12-10T13:19:45+00:00","dateModified":"2020-12-11T10:27:19+00:00","author":{"@id":"https:\/\/marketaylor.synology.me\/#\/schema\/person\/2d6f4113ff54187023e20c20186bbb3c"},"description":"Use the MQ REST Admin API to save a queue manager's configuration in JSON format. Similar to dmpmqcfg but easily-parseable output.","breadcrumb":{"@id":"https:\/\/marketaylor.synology.me\/?p=825#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/marketaylor.synology.me\/?p=825"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/marketaylor.synology.me\/?p=825#primaryimage","url":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","contentUrl":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","width":128,"height":51,"caption":"JSON"},{"@type":"BreadcrumbList","@id":"https:\/\/marketaylor.synology.me\/?p=825#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/marketaylor.synology.me\/"},{"@type":"ListItem","position":2,"name":"Save MQ configuration as JSON"}]},{"@type":"WebSite","@id":"https:\/\/marketaylor.synology.me\/#website","url":"https:\/\/marketaylor.synology.me\/","name":"Mark Taylor&#039;s Blog","description":"Messaging, Music and Moving Around","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/marketaylor.synology.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/marketaylor.synology.me\/#\/schema\/person\/2d6f4113ff54187023e20c20186bbb3c","name":"Mark","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9a5ae091c43730194cba7cabb5d65c1dc3f48d05caaddec6ff2319a1ce66376f?s=96&d=mm&r=g","caption":"Mark"},"sameAs":["https:\/\/x.com\/marketaylor"],"url":"https:\/\/marketaylor.synology.me\/?author=1"}]}},"jetpack_featured_media_url":"https:\/\/marketaylor.synology.me\/wp-content\/uploads\/2020\/12\/json-e1607682376243.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/posts\/825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=825"}],"version-history":[{"count":4,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/posts\/825\/revisions"}],"predecessor-version":[{"id":829,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/posts\/825\/revisions\/829"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=\/wp\/v2\/media\/830"}],"wp:attachment":[{"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marketaylor.synology.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}