Share My Creation [Project Template] Web API Server

aeric

Expert
Licensed User
Longtime User
I just use a new version when available:
 

aeric

Expert
Licensed User
Longtime User
Updates:
01/10/2022
- Web API Server - v1.14
- Manage Category in new page
- Dynamic populate Category dropdown in add/edit product dialog
- Improve JS scripts
- SQLite version point to sqlite-jdbc-3.39.3.0

Took me a while to fix the javascript bug form data become empty when validation failed. Now it is working fine.

edit: there is a minor bug. Will fix it soon.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
Web API Server - v1.16 beta 1 (Beta.zip attached in post #1)
Similar to Web API Template 2.0, it is now less confusing by using #Desc and #Elements for documentation

Note: This is a breaking update which causes B4X Web API Client not working (due to changes in Handler name to plural)
 

aeric

Expert
Licensed User
Longtime User
Updates:
12/04/2023
- Web API Server - v1.16
- Similar to Web API Template 2.0, it is now less confusing by using #Desc and #Path for documentation
- Web API Client - v1.0.5 (compatible with Web API Server v1.16)

Example:
B4X:
Private Sub GetCategory (cid As Int) As HttpResponseMessage
    #region Documentation
    ' #Desc = Get a category by id
    ' #Path = [":cid"]
    #End region
    Try
        Dim List1 As List
        List1.Initialize
       
        Dim con As SQL = Main.DB.GetConnection
        Dim strSQL As String = Main.queries.Get("SELECT_CATEGORY_BY_ID")
        Dim res As ResultSet = con.ExecQuery2(strSQL, Array As String(cid))
        Do While res.NextRow
            Dim Map2 As Map
            Map2.Initialize
            For i = 0 To res.ColumnCount - 1
                Select res.GetColumnName(i)
                    Case "id"
                        Map2.Put(res.GetColumnName(i), res.GetInt2(i))
                    Case Else
                        Map2.Put(res.GetColumnName(i), res.GetString2(i))
                End Select
            Next
            List1.Add(Map2)
        Loop
        res.Close
       
        If List1.Size > 0 Then
            HRM.ResponseCode = 200
        Else
            HRM.ResponseCode = 404
            HRM.ResponseError = "Category Not Found"
        End If
        HRM.ResponseData = List1
    Catch
        LogError(LastException)
        HRM.ResponseCode = 422
        HRM.ResponseError = "Error Execute Query"
    End Try
    Main.DB.CloseDB(con)
    Return HRM
End Sub

 
Last edited:

aeric

Expert
Licensed User
Longtime User
Hi
Is it already finished or does the version of the Web Api server 2.5 with the Dashboard exist?
Please start a new thread.
This is Web API Server template version 1.x but you are seems asking about version 2.x
If you are looking for Web API Server template 2.x then you can go to top of the first post, there is a link to that thread.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…