Sample code for 30+ languages & platforms
B4X

qa.factura1.com.co Obtain Auth Token

See more HTTP Misc Examples

Demonstrates how to send a JSON POST to get an authenticataion token for qa.factura1.com.co

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

Dim http As ChilkatHttp
http.Initialize("http")

'  Build the following JSON
'  {
'    "password": "MY_PASSWORD",
'    "username": "MY_USERNAME"
'  }

Dim json As ChilkatJsonObject
json.Initialize
json.EmitCompact = False
json.UpdateString("password", "MY_PASSWORD")
json.UpdateString("username", "MY_USERNAME")

Dim resp As ChilkatHttpResponse
resp.Initialize
success = http.HttpJson("POST", "https://qa.factura1.com.co/v2/auth", json, "application/json", resp)
If success = False Then
    Log(http.LastErrorText)
    Return
End If


Dim jsonResp As ChilkatJsonObject
jsonResp.Initialize
jsonResp.EmitCompact = False
jsonResp.Load(resp.BodyStr)

Log(jsonResp.Emit)

Log("Access token: " & jsonResp.StringOf("token"))