Skip to content

Custom APIs

While a standards-based API is a great start, sometimes you need custom endpoints tailored exactly to your business requirement. Initially the API exposes all your tables as collection endpoints. You can add additional endpoints by editing expose_services.py, as illustrated below.

Use Flask

You will observe the standard "Hello World" endpoint, which directly uses Flask. These do not appear in Swagger.

 

Use SAFRS: endpoint with swagger

You can create these as shown below, where we create an additional endpoint for add_order.

For more on customization, see SAFRS Customization docs.

To review the implementation, and how to use the debugger for your custom endpoints:

  1. Open Explorer > api/customize_api.py:
  2. Set the breakpoint as shown
  3. Use the swagger to access the ServicesEndPoint > add_order, and
  4. Try it out, then
  5. execute
  6. Your breakpoint will be hit
  7. You can examine the variables, step, etc.
  8. Click Continue on the floating debug menu (upper right in screen shot below)