B4J Question Pocketbase update record problem

thinktank

Member
Hello,

I am using pocketbase rest api method shared by our respected forum member mashiane. Here is the link;

https://www.b4x.com/android/forum/t...t-api-with-postman-and-then-httputils.144227/

I am able to successfully test view, create and delete record methods, however facing problem while updating the records, following is the code;

Code to Update PB record:
Private Sub btnUpdate_Click
   
    Dim baseUrl As String = "http://127.0.0.1:8090/api/collections/demo/records/ehqzy7uodj4zruu"
    Log(baseUrl)

    pb.Initialize(baseUrl)

    Dim u As Map = CreateMap()
   
    'u.Put("collectionId", "ji8q5yzgixkapg8")
    'u.Put("collectionName", "demo")

    u.Put("name", txtUpdate.Text)
    u.Put("fname", "test")
   
    Dim qs As String = pb.Map2Json(u)
    Dim j As HttpJob
   
    j.Initialize("pb", Me)
    j.PutString(baseUrl, qs)
    j.GetRequest.SetContentType("application/json")
       
    Wait For (j) JobDone(j As HttpJob)
   
    If j.Success Then
        Log("Updated...")
    Else
        Log(j.ErrorMessage)
    End If
   
    j.Release
   
End Sub

and I got following error in log output;

Error Log:
http://127.0.0.1:8090/api/collections/demo/records/ehqzy7uodj4zruu
ResponseError. Reason: Not Found, Response: {"code":404,"message":"Not Found.","data":{}}
{"code":404,"message":"Not Found.","data":{}}

Please help, TIA
 

Attachments

  • demo.png
    demo.png
    223.7 KB · Views: 147

Mashiane

Expert
Licensed User
Longtime User
I see. Please use example source code here. It has all crud functionality as per yesterdays update.

 
Upvote 0
Top