How do you do an API from Omnis?

Kelly Burgess kellyb at montana.com
Sat Aug 28 06:22:03 UTC 2021


Hi Das,

> Can anyone give me a clue how you do it in Omnis?

Look at Chapter 1 of the Extending Omnis docs, where there's a section on "Creating your own web services".

Easiest way to find it is go to the online docs - https://omnis.net/developers/resources/onlinedocs/index.jsp#
and search for 'restful api'.

"To create an Omnis RESTful API (ORA), set the $restful property of a remote task to kTrue, and provide a name in $restfulapiname (this name will appear in the Studio Browser when you have added some methods). Note: the $restful property is an inherited property, so if you create a subclass of a remote task with $restful set to kTrue, the subclass will also be $restful. Further note a remote task with $restful set to kTrue is not yet a member of an ORA. For each remote task that is to belong to an ORA (meaning that it provides URIs and methods for clients to call) set $restfulapiname. Note that all remote tasks in an ORA must be in the same library. The $restful and $restfulapiname properties are available at runtime in remote task instances."

I've only played with this when adapting Andrei Augustin's work on OAuth2 for an app that accessed DropBox.  Andrei implemented an rtAuthListener remote task class.  OAuth2 servers need to call back to your app via a restful API in order to obtain initial access approval.  This usage didn't require an Omnis Server - I think a runtime is capable - but I don't know if there are limitations that might require running an Omnis server.

Kelly


More information about the omnisdev-en mailing list