Question
· Jun 9, 2016

REST Services Cataloging

I've been building up a REST services API, consisting of a dozen or so classes referenced from a Dispatch class, which has route mappings for the first piece of the URI.  I'd like to have the Dispatch class be able to output all of the available Services, with some documentation.  Is there something like a %Library resource that I could use to pull this information from each of the classes?

Thanks

Chris

Discussion (7)0
Log in or sign up to continue

Hello Chris,

Are those "action classes" following a pattern? In other words: do you have some basic repeated structure from whiuch your REST API is made of? If yes, then the "action dispatcher" can be much less complex by using URL path encoded dispatch instead of routing. I had an example doing that for Ensemble (https://community.intersystems.com/post/creating-restful-service-using-ensemble) quite a time ago. It Works for non-Ensemble services too. 

The key is that you have a single dispatch method in your "action dispatcher", which calls the static methods of your "action classes" AND the class name of it somehow derived from a "movable part" of your URL path.