B4J Question HttJob API BASIC HTTP

imbault

Well-Known Member
Licensed User
Longtime User
Hello Team,

I need to use this API and cannot figure out using HttpJob
help would be great


Here it is :

GET /databases HTTP/1.1
Host: https://www.cloud.lims.fr/lims/webservices
Authorization: Basic base64CredentialsValue


The answer should be
[
{
"id": "example_backup_002.backup",
"date": "2020-01-01T10:00:00+0000",
"size": 19360
},
{
"id": "example_backup_001.backup",
"date": "2020-01-01T09:00:00+0000",
"size": 19360
}
]

Then
This entry point is used to retrieve the contents of a backup whose ID is set as a parameter /databases/{id}

Like this :


GET /databases/example_backup_002.backup
Host: https://www.cloud.lims.fr/lims/webservices
Authorization: Basic base64CredentialsValue
 
Last edited:

MicroDrie

Well-Known Member
Licensed User
Longtime User
If your problem is the JSON conversion, then the problem is the missing comma between the date and the size line.
Correct JSON code:
{
"id": "example_backup_002.backup",
"date": "2020-01-01T10:00:00+0000",
"size": 19360
},
{
"id": "example_backup_001.backup",
"date": "2020-01-01T09:00:00+0000",
"size": 19360
}
]

Which can be processed with

Program code:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim jRoot As Map = parser.NextObject
Dim date As String = jRoot.Get("date")
Dim size As Int = jRoot.Get("size")
Dim id As String = jRoot.Get("id")

Does this solve your question?
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Thank you, you are right concerning JSON, I corrected it.

My pb is making HttpJob work
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…