Lianja
Lianja
SCIS Health Check
See more SCiS Schools Catalogue Examples
Demonstrates the SCIS (Schools Catalogue Information Service) health check API call.Chilkat Lianja Downloads
llSuccess = .F.
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// Implements the following CURL command:
// curl -i -X GET --url https://api.scisdata.com/checkStatus -H 'Authorization: Basic ****'
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// This causes the "Authorization: Basic ****" to be added to each request.
loHttp.Login = "myLogin"
loHttp.Password = "myPassword"
loHttp.BasicAuth = .T.
loSbResponseBody = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://api.scisdata.com/checkStatus",loSbResponseBody)
if (llSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loSbResponseBody
return
endif
loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
? "Response Header:"
? loHttp.LastHeader
? "Failed."
release loHttp
release loSbResponseBody
release loJResp
return
endif
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
//
// {
// "subscriptionStatus": {
// "messages": [
// "Connection to SCIS API is successful",
// "User has a valid SCIS Data subscription"
// ]
// }
// }
release loHttp
release loSbResponseBody
release loJResp