Part #1: Get Started
Introduction
This tutorial is based on [Project Template] Pakai Server v5.
Installation
Option 1:
GET
Introduction
This tutorial is based on [Project Template] Pakai Server v5.
Installation
Option 1:
- Download and put the following files to Additional Libraries folder (don't put inside new subfolder)
B4J:
- Pakai Server (5.00).b4xtemplate
- EndsMeet.b4xlib (v1.10)
- WebApiUtils.b4xlib (v4.70)
- mysql-connector-java-8.0.30.jar (for MySQL)
B4X:
- MiniORMUtils.b4xlib (v3.30)
- Download and put Pakai Server (5.00).b4xtemplate to B4J Additional Libraries folder.
- Use LibDownloader to download the additional b4xlibs after you have created a new project.
- If you want to use MySQL database, you also need the mysql connector library.
- Start B4J IDE
- Select New from File menu and click on Pakai Server (5.xx)
- Confirm the Project Folder
- Enter the Project Name as you desired then click OK button.
- A project is created and ready to run under the default settings.
- Click Compile & Run (F5) from the Project menu or click the play button on the toolbar.
- When the project has finished to compile, hover you mouse pointer to the AppStart sub.
- Click on the highlighted link to open the app on your web browser.
- The index page will be loaded.
It shows a web application with CRUD functionality to:
- add a new product (Create),
- search for a product (Read),
- edit an existing product (Update) and
- delete a product (Delete). - The API endpoints are generated based on RESTful API principal.
- To see the list of APIs, click the API link with a gear icon on top navigation bar.
- The API documentation or help page displays the endpoints for GET, POST, PUT and DELETE represented in different colours.
- You can click on any item to expand the section.
GET
- Click on the first endpoint name [GET] Read all Categories.
- Click on the green Submit button and wait for the response.
- The response should return a JSON response with Code 200.
- To test a POST endpoint, click the third item which labeled [POST] Add new Category.
- Edit the content inside the Body text area
- Click on the purple Submit button and wait for the response.
- The response should return a JSON response with Code 201.
Last edited: