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 IndexIBM MQ API SupportAdd authorisations to an new created Queue MQAUTH_BROWSE etc

Post new topicReply to topic Goto page 1, 2, 3  Next
Add authorisations to an new created Queue MQAUTH_BROWSE etc View previous topic :: View next topic
Author Message
pcouas
PostPosted: Thu Jun 13, 2019 8:11 am Post subject: Add authorisations to an new created Queue MQAUTH_BROWSE etc Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Hi,

I could create an Queue like this
curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue -X POST -H "ibm-mq-rest-csrf-token: blank" -H "Content-Type: application/json" -d "{\"name\":\"MAQ1\"}"

But if i want send an message to this Queue i need in webConsole to add authorizationList on mqclient for my Queue
If i want to add authorisation without succes from REST like this
curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/oam/queue/MAQ1 -X POST -H "ibm-mq-rest-csrf-token: blank" -H "Content-Type: application/json" -k -u admin:passw0rd -d "{ "entityName": "mqclient", "entityType": "MQZAET_GROUP", "objectType": "MQOT_Q", "profileName": "MAQ1", "authorizationList": ["MQAUTH_BROWSE", "MQAUTH_INQUIRE", "MQAUTH_INPUT", "MQAUTH_OUTPUT"]}" -k -u admin:passw0rd

curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/oam -X POST -H "ibm-mq-rest-csrf-token: blank" -H "Content-Type: application/json" -k -u admin:passw0rd -d "{ \"entityName\": \"mqclient\", \"entityType\": \"MQZAET_GROUP\", \"objectType\": \"MQOT_Q\", \"profileName\": \"MAQ1\", \"authorizationList\": [\"MQAUTH_BROWSE\", \"MQAUTH_INQUIRE\", \"MQAUTH_INPUT\", \"MQAUTH_OUTPUT\"]}"


Which is good method ?

I don't see Authorisation added on webconsole with
curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue?attributes=* -X GET -H "ibm-mq-rest-csrf-token: blank" -H "Content-Type: application/json" -k -u admin:passw0rd -o c:/Users/t194656/zz.txt




Regards
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Jun 13, 2019 3:10 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

Authorisations is not one of the REST objects (yet?). So far only Queue Manager, Queues, Channels and Subscriptions have been provided.

So you'll have to use the MQSC interface.

Something like this.

Create a file, e.g. mqsc.json with the following contents.

Code:
{
  "type": "runCommand",
  "parameters": {
    "command": "SET AUTHREC PROFILE(MAQ1) OBJTYPE(QUEUE) GROUP('mqclient') AUTHADD(BROWSE,INQ,GET,PUT)"
  }
}


Then run this command through the REST interface thus:-

Code:
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd -H "Content-Type: application/json" -d "@mqsc.json"


N.B. The @ symbol in the -d parameter tells it that you have given it a file name.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software


Last edited by hughson on Fri Jun 14, 2019 3:45 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
pcouas
PostPosted: Fri Jun 14, 2019 1:53 am Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Hi

I need an file ? Command line seems short ?

curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{ \"type\": \"runCommand\", \"parameters\": { \"command\": \"SET AUTHREC PROFILE(MAQ1) OBJTYPE(QUEUE) GROUP('mqclient') AUTHADD(BROWSE,INQUIRE,INPUT,OUTPUT)\" }}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd


{
"commandResponse": [
{
"completionCode": 0,
"reasonCode": 0,
"text": ["AMQ8405I: Syntax error detected at or near end of command segment below:-"]
},
{
"completionCode": 0,
"reasonCode": 0,
"text": ["SET AUTHREC PROFILE(MAQ3) OBJTYPE(QUEUE) GROUP('mqclient') AUTHADD(BROWSE,INQU"]
},
{
"completionCode": 0,
"reasonCode": 0,
"text": ["AMQ8427I: Valid syntax for the MQSC command: SET AUTHREC [ PROFILE( profile_name ) ] OBJTYPE( AUTHINFO | CHANNEL | CLNTCONN | COMMINFO | LISTENER | NAMELIST | PROCESS | QMGR | QUEUE | RQMNAME | SERVICE | TOPIC ) PRINCIPAL( principal_name ) | GROUP( group_name ) [ AUTHADD( authority_list ) ] [ AUTHRMV( authority_list ) ] [ SERVCOMP( service_component_name ) ] authority_list := NONE | ALTUSR | BROWSE | CHG | CLR | CONNECT | CRT | CTRL | CTRLX | DLT | DSP | GET | INQ | PASSALL | PASSID | PUB | PUT | RESUME | SET | SETALL | SETID | SUB | SYSTEM | ALL | ALLADM | ALLMQI"]
}
],
"overallCompletionCode": 2,
"overallReasonCode": 3008
}
Back to top
View user's profile Send private message
hughson
PostPosted: Fri Jun 14, 2019 3:44 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
I need an file ?

No, you don't need a file, but I find it easier to use a file, so I gave my example as a file.

pcouas wrote:
Command line seems short ?

That is the beauty of using the file mechanism!

Apologies I had a typo in my earlier post. INQUIRE should just be INQ. INPUT should be GET, and OUTPUT should be PUT. I've corrected my above post to correct the example. I did it from memory and hadn't had the opportunity to test it out as no REST webserver currently set up.

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
hughson
PostPosted: Fri Jun 14, 2019 3:44 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
I need an file ?

No, you don't need a file, but I find it easier to use a file, so I gave my example as a file.

pcouas wrote:
Command line seems short ?

That is the beauty of using the file mechanism!

Apologies I had a typo in my earlier post. INQUIRE should just be INQ. INPUT should be GET, and OUTPUT should be PUT. I've corrected my above post to correct the example. I did it from memory and hadn't had the opportunity to test it out as no REST webserver currently set up.

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
pcouas
PostPosted: Fri Jun 14, 2019 4:18 am Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Yes i have found
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"SET AUTHREC PROFILE(MAQ1) OBJTYPE(QUEUE) GROUP('mqclient') AUTHADD(BROWSE,INQ,PUT,GET)\"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd

Do you know we you implement complete PCF command.
Currently we use Java API mq and we want replace It by REST ?

Regards
Back to top
View user's profile Send private message
hughson
PostPosted: Fri Jun 14, 2019 1:22 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
Currently we use Java API mq and we want replace It by REST ?

As noted in an earlier response, the REST API is incomplete - only implemented for queue managers, queues, channels and subscriptions. The MQSC interface was added to "plug the gaps".

The REST API is also incomplete for the MQ API too. Not all the options are implemented.

You will have to carefully review your Java API MQ applications to determine if you can do all the things you need to do through the REST API.

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
pcouas
PostPosted: Mon Jun 17, 2019 1:24 am Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Hi

I trying to delete my Queue but it seems this functionality is not implemented ?
curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue -X DELETE -H "ibm-mq-rest-csrf-token: blank" -H "Content-Type: application/json" -d "{\"name\":\"MAQ1\"}" -k -u admin:passw0rd

"message": "MQWB0010E: The HTTP method 'DELETE' is not allowed for 'queue' objects.",

i have found a solution with mqsc
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"DELETE QLOCAL (QQ1) PURGE\"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd
Back to top
View user's profile Send private message
hughson
PostPosted: Mon Jun 17, 2019 2:02 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
I trying to delete my Queue but it seems this functionality is not implemented ?


It has been implemented, you are just using it incorrectly. Try the following, i.e. add the queue name to the end of the URL you tried, rather than providing the queue name as JSON payload.

Code:
curl https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue/QQ1 -X DELETE -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd


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
pcouas
PostPosted: Mon Jun 17, 2019 2:05 am Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Ok I could purge it too ?
Back to top
View user's profile Send private message
hughson
PostPosted: Mon Jun 17, 2019 2:07 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

Yes purge is also available - see the reference page here:-

https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.ref.adm.doc/q129040_.htm

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
pcouas
PostPosted: Mon Jun 17, 2019 8:50 am Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Ok
1 There is no POST method to create Channel , just GET ?
2 I could not create PROCESS too ?

Regards
Back to top
View user's profile Send private message
hughson
PostPosted: Mon Jun 17, 2019 2:17 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
1 There is no POST method to create Channel , just GET ?
2 I could not create PROCESS too ?


As I said earlier:
hughson wrote:
So far only Queue Manager, Queues, Channels and Subscriptions have been provided.


If you look at the reference page for Channels, you will see that indeed it only provides GET.

In fact, if you look at this page, you will see exactly what is available and what is not available.

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
pcouas
PostPosted: Mon Jun 17, 2019 10:50 pm Post subject: Reply with quote

Acolyte

Joined: 06 Sep 2011
Posts: 72

Hi,

There is no work around with 'mqsc' using REST ?
Ok
I have found for Channel
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"define channel (QM_ORANGE.QM_APPLE) chltype (RCVR) trptype (TCP)\"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd

and for Process
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"define process (PROCESS1) \"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd

But now webconsole https://localhost:9443/ibmmq/console/ not responding

Regards
Back to top
View user's profile Send private message
hughson
PostPosted: Tue Jun 18, 2019 12:39 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1212
Location: Bay of Plenty, New Zealand

pcouas wrote:
There is no work around with 'mqsc' using REST ?


As I said earlier, you can always use the MQSC REST interface if the object you wish to interact with is not yet implemented in the REST API.

hughson wrote:
As noted in an earlier response, the REST API is incomplete - only implemented for queue managers, queues, channels and subscriptions. The MQSC interface was added to "plug the gaps".



pcouas wrote:
I have found for Channel
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"define channel (QM_ORANGE.QM_APPLE) chltype (RCVR) trptype (TCP)\"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd

and for Process
curl https://localhost:9443/ibmmq/rest/v1/admin/action/qmgr/QM1/mqsc -X POST -H "Content-Type: application/json" -d "{\"type\": \"runCommand\",\"parameters\": {\"command\": \"define process (PROCESS1) \"}}" -H "ibm-mq-rest-csrf-token: blank" -k -u admin:passw0rd

But now webconsole https://localhost:9443/ibmmq/console/ not responding


What do the logs for the mqweb server say about this? Both the REST API and the MQ Console use the same mqweb server. See File structure of the IBM MQ Console and REST API installation component for the location of the logs.

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
Display posts from previous:
Post new topicReply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum IndexIBM MQ API SupportAdd authorisations to an new created Queue MQAUTH_BROWSE etc
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.