B4J Question [Q&A] Web API Server 3

aeric

Expert
Licensed User
Longtime User
The proper way is to post your own question regarding this project template.

However, I created this thread as a one-stop place for all the Q&A.

This thread may become long (or not). I am not sure but some members prefer to read a long thread.

You are welcome to ask any question or post a suggestion if you think it is related.

Maybe I will edit this first post by adding a list of FAQs.
I added a FAQ section on second post.

Thanks.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
Frequently Asked Questions (FAQ)

[Stub]

  1. What is the difference between Web API vs REST API?
    Basically REST API is API or Web API that follows the REST principals. Usually it consists of GET, POST, PUT and DELETE. It is also commonly associated with database CRUD operations that is Create, Read, Update and Delete.

  2. Can I create API that is not RESTful?
    Yes. It is your decision to use any methods which suited for your use cases. You may not need to use all the Http methods.

  3. Is this project template only can be use for creating API server?
    No. You can use this template to develop full-stack web application.
 
Upvote 0

CR95

Active Member
Licensed User
Thanks for your clear and detailed tutorial

However, I have 2 remarks and 2 questions :

In the paragraph "Running the Project", you say
To see the list of APIs, click the API link with a gear icon on top navigation bar
Nothing happens when clicking on the gear

In the paragraph "Perform Test", you say
Click on the second end point labeled GET /api/categories/:id
But I don't see this end point.

What are the purposes of the 3 (commented) command lines in the beginning :

B4X:
' ConfigureServer:     ide://goto?Module=Main&Sub=AppStart
' Objects folder:     ide://run?file=%WINDIR%\SysWOW64\explorer.exe&Args=%PROJECT%\Objects
' Publish:             ide://run?file=%JAVABIN%\jar.exe&WorkingDirectory=../Objects&Args=-cMf&Args=Publish.zip&Args=www&Args=*.jar&Args=*.ini&Args=*.db&Args=help.html

The www directory in Objects has to be copied to the remore server. Right ?

Thanks aeric
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Run in debug mode to generate the API documentation.
For production, you can use the Publish comment link after compile in Release mode. The www folder will copy into the zip file.
You need to run the debug and browse to API documentation page at least once to generate the help.html file inside the Objects folder.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…