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 IndexWebSphere Message Broker SupportBest practice for REST in IIBv9

Post new topicReply to topic
Best practice for REST in IIBv9 View previous topic :: View next topic
Author Message
Vitor
PostPosted: Thu Mar 16, 2017 12:06 pm Post subject: Best practice for REST in IIBv9 Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24217
Location: Ohio, USA

So we're (belatedly) getting into REST services inside the organization. Where we've called such services up to this point, it's been to external services to a single URL.

In the SOAP world, endpoint and operation are separately selectable attributes. In the REST world, it's a single URL. We observe that you can dynamically build both query parameters and operation in the local environment tree, but the operation seems to replace the URL specific in the HTTP request node. Remediating that is a simple matter of holding the URL as a UDP and building the whole URL in ESQL, but is there a better way? What (if anything) are we missing? How do other people manage a situation where the base URL is the same for all operations, but changes by environment so can't be hard coded?

Helpful links in the InfoCenter that I've overlooked may be posted with as much sarcasm and irony as the poster feels is relevant.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 16, 2017 12:35 pm Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17059

A proper REST api wouldn't have the exact same URL for every operation.

It would be things like http://rest.example.org/music/album

Then you would do a GET on that URL to get a list of albums.

But if you wanted to get a list of artists, the url would be http://rest.example.org/music/artists
If you wanted to get a list of all albums from an artist, it might be something like
http://rest.example.org/music/artists/<artist name>/albums

So your REST api has objects for albums, and artists. And you do GET/PUT/POST/DELETE on those objects, with different URLs.

See, for example (ahem) https://docs.internetofthings.ibmcloud.com/swagger/v0002.html
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 17, 2017 4:20 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24217
Location: Ohio, USA

My bad.

I meant how to handle:

http://rest.uat-example.org/music/albums

http://rest.qa-example.org/music/albums

http://rest.preprod-example.org/music/albums

http://rest.example.org/music/albums

as you move through the lifecycle at Example Music Inc.

I accept your other points and embrace them.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 17, 2017 4:55 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17059

... are you listening to URLs or calling them?

If you're calling them, it's the usual case of 'how do I know what environment I'm running in'

If you're listening to them, then it's a configurable property on the HTTTPInputNode, isn't it?
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 17, 2017 5:15 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24217
Location: Ohio, USA

Calling them.

So environment specific UDPs is pretty good?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 17, 2017 5:54 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17059

Vitor wrote:
Calling them.

So environment specific UDPs is pretty good?


Well, it certainly works.

But, how do you solve this question of "what environment am I in?" elsewhere?
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 17, 2017 6:02 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24217
Location: Ohio, USA

Promoting node properties and changing them at deploy time.

So to clarify:

We can either promote the URL property of the HTTP request node or we can build the URL in the LocalEnvironment and pass it forward. We're not missing a capability where we can set http://rest.example.org in the node and either /music or /books in LocalEnvironment.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 17, 2017 6:28 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17059

The RequestURI

https://www.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac04595_.htm

Edit:
The RequestLine.RequestURI
Quote:
Overrides the RequestURI, which is the path after the URL and port. For example:

SET OutputLocalEnvironment.Destination.HTTP.RequestLine.RequestURI = '/abc/def';

_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 17, 2017 6:52 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24217
Location: Ohio, USA

mqjeff wrote:
The RequestURI

https://www.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac04595_.htm

Edit:
The RequestLine.RequestURI
Quote:
Overrides the RequestURI, which is the path after the URL and port. For example:

SET OutputLocalEnvironment.Destination.HTTP.RequestLine.RequestURI = '/abc/def';


Now that's the missing piece!

God bless you oh most worthy associate! Buy you a drink on next meeting.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 17, 2017 7:03 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17059

Vitor wrote:
Now that's the missing piece!


My KC foo is still strong...
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportBest practice for REST in IIBv9
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.