Android Question OkHttpUtils2 - PostString fails

LGS

Member
Licensed User
Longtime User
Hello everyone.
I had the need to update an application that uses a client API.

But the client updated the URL of that API.
https://serverxxxxx/v3/api
to
https://serverxxxxx/v3.1/api

The following was updated in the code:
targetSdkVersion="32" to targetSdkVersion="34"

B4X:
'    Dim endpointUrl As String = "https://serverxxxxx/v3/api"   'the previous url
    Dim endpointUrl As String = "https://serverxxxxx/v3.1/api" 'the new url
    
    Dim ok As HttpJob
    ok.Initialize("",Me)
    ok.PostString(endpointUrl,data)
    ok.GetRequest.SetHeader("Authorization", "reg-platform us10")
    ok.GetRequest.SetHeader("Cache-Control","no-cache")
    ok.GetRequest.SetHeader("APIKey","123456")
    ok.GetRequest.SetContentType("application/json")
    Wait For (ok) Jobdone(ok As HttpJob)
    If ok.Success Then
        Log(ok.GetString)
    Else
        Log(ok.ErrorMessage) 'Just show this in the log:
                                    'ResponseError. Reason: , Response:
    End If

Now HttpJob is not executed and ErrorMessage does not specify anything
1737784804314.png


I would like to know how to identify in the log what the error is.

Or if anyone has any suggestions to help me solve this

Thankful in advance
 

drgottjr

Expert
Licensed User
Longtime User
what is the new api? how is it different from the old api?
 
Upvote 0

LGS

Member
Licensed User
Longtime User
Hi teddybear, drgottjr
The API is running in other systems
It chance the Url https//....v3... Yo https//....v3.1...
That was the change
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
Hi teddybear, drgottjr
The API is running in other systems
It chance the Url https//....v3... Yo https//....v3.1...
That was the change
not to put words in @teddybear's mouth, but i don't think we're saying that api 3.1 doesn't work. it makes no sense to have a version 3.1 if it isn't differet from 3. what's the difference in the api? perhaps we might know the url so that we can look at the documentation?
 
Upvote 0

LGS

Member
Licensed User
Longtime User
What I mean is that in other systems (Web) the API is working without problems.

The client only indicated the following:
"To continue providing data into the GRP you will need to update your API connection by simply updating the base URL.
All other configurations will remain the same, including your API Key

I don't have details of what changes they made to the API.
On Monday I will try to investigate more.

Thank you for your support
 
Upvote 0
Top