Skip to content

ogurecapps/int-rest-api-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Interoperability REST API Template

Yet another API template for the InterSystems IRIS Data platform

Production

What's new?

Added simple implementation of rate limits. Now, you can set up the maximum amount of requests per minute for your APIs. Just set the value by the route key in the lookup table RESTRateLimits, similar RESTRoutes table. Also, you can use a wildcard (*) as a method name: Sample.API:*

Tip: If you need a more flexible and enterprise solution, I advise you to look at API Manager

About

Features out-of-the-box:

  • Adds online OpenAPI 2.0 specification (see /swagger endpoint) to your APIs
  • Adds /healthcheck endpoint - a simple way to check API publication
  • Metrics in OpenMetrics format are included
  • Rate limits (requests per minute) can be set
  • And main: adds to all your API common entry point in Interoperability (Production). That, in turn, allows you to use the best IRIS feature - visual traces! 🔥

Quick start

  1. Implement the needed API using a specification-first way
  2. Add to your .disp class routes /swagger and /healthcheck (see Sample.API.disp for example)
  3. Add calls REST.Service.API to your .impl class (see example in Sample.API.impl)
Quit ##class(REST.Service.API).Call(body, $$$CurrentMethod, $CLASSNAME())
  1. Add to Production REST.Service.API service
  2. Create and add to Production handlers for the methods of your custom API. Set REST.Process.CallHandler as the parent class if you need correct links building in Production UI. You can find a sample of handler in the Sample.Process.TestPost class
  3. Add routes for API methods to the RESTRoutes lookup table (sample RESTRoutes.LUT)
  4. Enjoy! 😎

Monitoring

All metrics are provided in OpenMetrics format. So, you can grab it with Prometheus and visualize it in Grafana. Details about setting up monitoring in the IRIS can be found here. Don't forget to check the roles of api/monitor application and to enable custom sensors in the IRIS terminal:

zn "%SYS"
d ##class(SYS.Monitor.SAM.Config).AddApplicationClass("REST.Core.Monitor", "YOUR_NAMESPACE")

About

Yet another API template for the InterSystems IRIS Data platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published