Sample code for 30+ languages & platforms
Go

SCIS Health Check

See more SCiS Schools Catalogue Examples

Demonstrates the SCIS (Schools Catalogue Information Service) health check API call.

Chilkat Go Downloads

Go
    success := false

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

    http := chilkat.NewHttp()

    // 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.
    http.SetLogin("myLogin")
    http.SetPassword("myPassword")
    http.SetBasicAuth(true)

    sbResponseBody := chilkat.NewStringBuilder()
    success = http.QuickGetSb("https://api.scisdata.com/checkStatus",sbResponseBody)
    if success == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        sbResponseBody.DisposeStringBuilder()
        return
    }

    jResp := chilkat.NewJsonObject()
    jResp.LoadSb(sbResponseBody)
    jResp.SetEmitCompact(false)

    fmt.Println("Response Body:")
    fmt.Println(*jResp.Emit())

    respStatusCode := http.LastStatus()
    fmt.Println("Response Status Code = ", respStatusCode)
    if respStatusCode >= 400 {
        fmt.Println("Response Header:")
        fmt.Println(http.LastHeader())
        fmt.Println("Failed.")
        http.DisposeHttp()
        sbResponseBody.DisposeStringBuilder()
        jResp.DisposeJsonObject()
        return
    }

    // 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"
    //     ]
    //   }
    // }

    http.DisposeHttp()
    sbResponseBody.DisposeStringBuilder()
    jResp.DisposeJsonObject()