ChannelInitiatorController

The second part of the URI must be chinit to call the ChannelInitiatorController. This controller is only useable for queuemanagers running on z/OS.

inquire

Get info about the channel initiator. This api executes the MQCMD_INQUIRE_CHANNEL_INIT pcf command. On success, the returned JSON object will have a data array, on failure an error object.

URL Parameters

/api/chinit/inquire/<QueueManager>

QueueManager

The name of the queuemanager. This parameter is required.

Query Parameters

CommandScope

Specifies how the command is executed when the queuemanager is a member of a queue-sharing group. This parameter applies to z/OS only.

Example

/api/chinit/inquire/PIGEON

JSON Object

When using an application/json POST request you can post a JSON object with names like the query parameters.

All URL parameters and query parameters are ignored except for the URL parameter for the name of the queuemanager.

There are some differences between query parameters and a JSON object:

This sample is a Perl script that inquires the channel initiator:

#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);

use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;

# Get channel initiatior information

my $qmgr = shift;
die("Please pass me the name of a queuemanager as argument")
	unless defined($qmgr);

my $json = JSON->new;

my %input = ();
my $content = $json->encode(\%input);

my $ua = LWP::UserAgent->new;
my $req = POST 'http://localhost:8081/api/chinit/inquire/' . $qmgr;
$req->header(
	'Content-Type' => 'application/json',
	'Content-length' => length($content)
);
$req->content($content);

my $res = $ua->request($req);
die $res->status_line unless $res->is_success;

my $mqweb = $json->decode($res->content());
if ( exists($mqweb->{error}) ) {
	say 'An MQ error occurred while inquiring queues.';
	say 'Reason Code: '
		, $mqweb->{error}->{reason}->{code}
		, ' - '
		, $mqweb->{error}->{reason}->{desc};
}
else {
	foreach my $response(@{$mqweb->{data}}) {
		if ( exists($response->{TransportType})
			   && $response->{TransportType}->{display} eq 'TCP' ) {
			my $ip = '';
			if ( exists ($response->{IPAddress}) ) {
				$ip = $response->{IPAddress}->{value};
			} else {
				$ip = '?';
			}
			$ip .= ':';
			if ( exists ($response->{Port}) ) {
				$ip .= $response->{Port}->{value};
			} else {
				$ip .= '?';
			}

			say $response->{TransportType}->{display}
				, ' - '
				, $ip
				, ' - '
				, $response->{Status}->{display};
		}
	}
}