PowerServer utilizes Web APIs to interact with databases, allowing PowerBuilder applications to retrieve or update data via RESTful services, instead of directly connecting to a database as in traditional client-server applications. These Web APIs are specifically generated for PowerBuilder applications and are tightly integrated into the PowerServer environment.
Introduction
PowerServer Web APIs is a set of standard REST/JSON APIs contained in the ASP.NET Core application, compiled from the PowerServer C# solution. These APIs serve as the backend for PowerBuilder client applications, facilitating seamless interaction with databases. They expose CRUD (Create, Read, Update, Delete) functionalities, which are essential for PowerBuilder applications. The data which represents DataWindow result set and buffer information is returned in JSON format, allowing the client application to process and display it. Each set of PowerServer Web APIs is tailored to a specific PowerBuilder application and is not intended for use by any other application.
Key Features
-
RESTful Services: The PowerServer Web APIs use REST/JSON services, enabling smooth communication between PowerBuilder applications and the backend databases.
-
Data Access: When data retrieval or updates are requested, the Web APIs interact with the database through the C# models and return the data in JSON format.
-
Integration with PowerServer: The Web APIs are tightly integrated with the PowerServer environment, offering backend services specifically designed for PowerBuilder client applications.
-
ASP.NET Core Integration: The Web APIs are part of the ASP.NET Core application compiled from the PowerServer C# solution, and must run on a web server to function properly.
External Access and Customization
Although PowerServer Web APIs are generated specifically for PowerBuilder client applications, it is possible to create APIs accessible to external applications, such as Java web apps or other non-PowerBuilder clients. To achieve this, open the PowerServer C# solution in SnapDevelop (or any other C# editor) and create services, controllers, and API interfaces. You can also take advantage of the PowerBuilder .NET DataStore project to simplify the creation of services, controllers, and API interfaces, for both PB and non-PB clients.
Deployment and File Structure
If you select to deploy to the local Kestrel server from the PowerBuilder IDE, the files are generated and stored as follows:
-
The compiled files for Web APIs will be generated and stored under the "bin" folder of the ServerAPIs project in the solution, for example, %username%\source\repos\salesdemo_cloud\ServerAPIs\bin\Release\net8.0.
The compiled files include the final executable (ServerAPIs.exe) and supporting files/folders (*.dll, *.json, *.pdb etc.).
-
The static files (including the client app, launcher, and runtime) will be generated under the "wwwroot" folder of the ServerAPIs project, for example, %username%\source\repos\salesdemo_cloud\ServerAPIs\wwwroot.
For further details on running PowerServer Web APIs with Kestrel, refer to Hosting server: Kestrel.
If you select to deploy to IIS from the PowerBuilder IDE, the compiled files for Web APIs and the static files will be deployed to the specified IIS web site (for example, the Web APIs is stored in C:\inetpub\wwwroot\salesdemo_cloud_API).
The compiled files include the final executable (ServerAPIs.exe), supporting files/folders (*.dll, *.json, *.pdb etc.), and web.config (for IIS deployment). For further details on running PowerServer Web APIs on IIS, refer to Hosting server: IIS (in-process hosting).
If you select to deploy to a folder from the PowerBuilder IDE, the compiled files for Web APIs will be generated in a folder (you can move this folder to the hosting environment such as IIS, Docker, Kubernetes etc.). You can also open the PowerServer C# solution in SnapDevelop and then publish the ServerAPIs project to Docker or Kubernetes.
The compiled files include the final executable (ServerAPIs.exe), supporting files/folders (*.dll, *.json, *.pdb etc.), and web.config (for IIS deployment). For how to deploy PowerServer Web APIs to Docker, Kubernetes etc., refer to Hosting server: Docker, Hosting server: Kubernetes or more sections under Server Setup.