How can I create REST API from SQL Server database using OutSystem

Hi Team,


I need some help on REST API creation using OutSystem. Could you please let me know how to create REST API on existing database using OutSystem

Hi Avijit,

There's good documentation available about exposing REST APIs with the OutSystems Platform. Have you read them?

Secondly, what do you mean with "[a] REST API on [an] existing database"? REST APIs are used to communicate data, but they do not live "on a database". Can you explain a bit what you mean?

Hi Nordin and Kilian,

Thanks both of you for your response. I have already consulted the above urls but my requirement is bit different. I have attached a representational diagram for your reference and understanding. 

Thanks,

Avijit


Hi Avijit,

The image and your description doesn't describe the requirements into detail. 

If you want to expose an Rest API that gets/saves data from an external database, you might want following url. https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/Integrate_with_an_External_Database 

Regards,


Hans

Hi Avijit,

There's no automatic way to expose the content of the database via a REST API. I'd say that's a good thing, as you'd typically want to expose data via REST differently than data via a database (for starters, REST allows nested data, while query results are always "flat" with possibly redundant data).

REST is about exposing resources, and sometimes allowing to update and create them as well. But typically, they use a higher-level abstraction than the physical database tables, e.g. you may have a Users end-point that returns user-related data, while the actual data is stored in more than one Entity.

My advice: make an overview of which data you want to expose to the outside world, make conceptual groupings, define filters (if applicable), and create a decent REST API using common best practices.

Solution

Hi All 


Firstly thanks for the help and comment. 

Please find below my understanding. 

Kilian Hekhuis wrote:

Hi Avijit,

There's no automatic way to expose the content of the database via a REST API. I'd say that's a good thing, as you'd typically want to expose data via REST differently than data via a database (for starters, REST allows nested data, while query results are always "flat" with possibly redundant data).

REST is about exposing resources, and sometimes allowing to update and create them as well. But typically, they use a higher-level abstraction than the physical database tables, e.g. you may have a Users end-point that returns user-related data, while the actual data is stored in more than one Entity.

My advice: make an overview of which data you want to expose to the outside world, make conceptual groupings, define filters (if applicable), and create a decent REST API using common best practices.

 Hi Kilian,


Thanks for the message, however it does not helped me to resolve the issue. The link shared by Hans is really helpful. I have successfully created the REST API using OutSystem. 

Reference link from Hans : https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/Integrate_with_an_External_Database

The steps are simple:

Step 1: Connect database using Integration Studio, expose that as extension.

Step 2: Add the extension to Service Studio and check the availability of the database 


Step 3: Create Expose REST API in logic section.

Step 4: Write your logic in REST method. I have used below logic. 


 


 

Solution