Sample code for 30+ languages & platforms
AutoIt

SCIS Search

See more SCiS Schools Catalogue Examples

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

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oHttp = ObjCreate("Chilkat.Http")

;  Implements the following CURL command:

;  curl -i -X GET --url 'https://api.scisdata.com/catalogue/api/search?query=titleSearch%3Adogs%20AND%20publicationYear%3A2015&from=0&size=20&sort=author&order=asc' -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.
$oHttp.Login = "myLogin"
$oHttp.Password = "myPassword"
$oHttp.BasicAuth = True

$oSbQuery = ObjCreate("Chilkat.StringBuilder")
$oSbQuery.Append("titleSearch:dogs AND publicationYear:2015")

$oSbUrl = ObjCreate("Chilkat.StringBuilder")
$oSbUrl.Append("https://api.scisdata.com/catalogue/api/search?query=")
;  If non-usascii chars are included in the search, we don't know if utf-8 or windows-1252 is desired by the server.  You'll need to find out..
$oSbUrl.Append($oSbQuery.GetEncoded("url","utf-8"))
$oSbUrl.Append("&from=0&size=20&sort=author&order=asc")

$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb($oSbUrl.GetAsString(),$oSbResponseBody)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oHttp.LastHeader & @CRLF)
    ConsoleWrite("Failed." & @CRLF)
    Exit
EndIf

;  Sample JSON response:
;  (Sample code for parsing the JSON response is shown below)

;  {
;    "data": {
;      "hits": {
;        "hits": [
;          {
;            "_index": "scisdata2",
;            "_type": "bibdatatype",
;            "_source": {
;              "isbn": [
;                "9781517638160"
;              ],
;              "languageTermCode": [
;                "eng"
;              ],
;              "mainAuthor": {
;                "namePersonalPrimary": [
;                  "Abbott, Eleanor Hallowell."
;                ]
;              },
;              "title": {
;                "titlePrimary": [
;                  "Peace on Earth, good-will to dogs"
;                ],
;                "noteStmOfResponsibility": [
;                  "by Eleanor Hallowell Abbott."
;                ]
;              },
;              "scisType": [
;                "Book"
;              ],
;              "dateIssuedMarc": 2015,
;              "languageTermValue": [
;                "English"
;              ],
;              "contributor": {},
;              "isbn13": "9781517638160",
;              "imageFileName": "9781517638160.jpg",
;              "publicationDetails": "United States, Create Space Independent Publishing Platform, 2015",
;              "isbn10": "151763816X",
;              "id": "1867852"
;            },
;            "_id": "1867852",
;            "sort": [
;              "abbott, eleanor hallowell."
;            ],
;            "_score": null
;          },
;          {
;            "_index": "scisdata2",
;            "_type": "bibdatatype",
;            "_source": {
;              "isbn": [
;                "9781780747910"
;              ],
;              "languageTermCode": [
;                "eng"
;              ],
;              "mainAuthor": {
;                "namePersonalPrimary": [
;                  "Adams, Richard."
;                ]
;              },
;              "title": {
;                "titlePrimary": [
;                  "The plague dogs"
;                ],
;                "noteStmOfResponsibility": [
;                  "Richard Adams."
;                ]
;              },
;              "scisType": [
;                "Book"
;              ],
;              "dateIssuedMarc": 2015,
;              "languageTermValue": [
;                "English"
;              ],
;              "contributor": {},
;              "isbn13": "9781780747910",
;              "imageFileName": "9781780747910.jpg",
;              "publicationDetails": "New York, Rock the Boat, 2015",
;              "isbn10": "1780747918",
;              "id": "1749228"
;            },
;            "_id": "1749228",
;            "sort": [
;              "adams, richard."
;            ],
;            "_score": null
;          },
;           ...
;        ],
;        "total": 84,
;        "max_score": null
;      },
;      "took": 585,
;      "timed_out": false
;    },
;    "subscriptionStatus": {}
;  }

;  Sample code for parsing the JSON response...
;  Use the following online tool to generate parsing code from sample JSON:
;  Generate Parsing Code from JSON

Local $sV_index
Local $sV_type
Local $iV_sourceDateIssuedMarc
Local $sV_sourceIsbn13
Local $sV_sourceImageFileName
Local $sV_sourcePublicationDetails
Local $sV_sourceIsbn10
Local $sV_sourceId
Local $sV_id
Local $sV_score
Local $iJ
Local $iCount_j
Local $strVal

Local $iDataHitsTotal = $oJResp.IntOf("data.hits.total")
Local $sDataHitsMax_score = $oJResp.StringOf("data.hits.max_score")
Local $iDataTook = $oJResp.IntOf("data.took")
Local $bDataTimed_out = $oJResp.BoolOf("data.timed_out")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("data.hits.hits")
While $i < $iCount_i
    $oJResp.I = $i
    $sV_index = $oJResp.StringOf("data.hits.hits[i]._index")
    $sV_type = $oJResp.StringOf("data.hits.hits[i]._type")
    $iV_sourceDateIssuedMarc = $oJResp.IntOf("data.hits.hits[i]._source.dateIssuedMarc")
    $sV_sourceIsbn13 = $oJResp.StringOf("data.hits.hits[i]._source.isbn13")
    $sV_sourceImageFileName = $oJResp.StringOf("data.hits.hits[i]._source.imageFileName")
    $sV_sourcePublicationDetails = $oJResp.StringOf("data.hits.hits[i]._source.publicationDetails")
    $sV_sourceIsbn10 = $oJResp.StringOf("data.hits.hits[i]._source.isbn10")
    $sV_sourceId = $oJResp.StringOf("data.hits.hits[i]._source.id")
    $sV_id = $oJResp.StringOf("data.hits.hits[i]._id")
    $sV_score = $oJResp.StringOf("data.hits.hits[i]._score")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.isbn")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.isbn[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.languageTermCode")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.languageTermCode[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.mainAuthor.namePersonalPrimary")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.mainAuthor.namePersonalPrimary[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.title.titlePrimary")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.title.titlePrimary[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.title.noteStmOfResponsibility")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.title.noteStmOfResponsibility[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.scisType")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.scisType[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.languageTermValue")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.languageTermValue[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i].sort")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i].sort[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.contributor.namePersonalOther")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.contributor.namePersonalOther[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("data.hits.hits[i]._source.contributor.nameCorporateOther")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("data.hits.hits[i]._source.contributor.nameCorporateOther[j]")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend