Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) SCIS Search

See more SCiS Schools Catalogue Examples

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

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Handle hoSbQuery
    Handle hoSbUrl
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sV_index
    String sV_type
    Integer iV_sourceDateIssuedMarc
    String sV_sourceIsbn13
    String sV_sourceImageFileName
    String sV_sourcePublicationDetails
    String sV_sourceIsbn10
    String sV_sourceId
    String sV_id
    String sV_score
    Integer j
    Integer iCount_j
    String sStrVal
    Integer iDataHitsTotal
    String sDataHitsMax_score
    Integer iDataTook
    Boolean iDataTimed_out
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // 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.
    Set ComLogin Of hoHttp To "myLogin"
    Set ComPassword Of hoHttp To "myPassword"
    Set ComBasicAuth Of hoHttp To True

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbQuery
    If (Not(IsComObjectCreated(hoSbQuery))) Begin
        Send CreateComObject of hoSbQuery
    End
    Get ComAppend Of hoSbQuery "titleSearch:dogs AND publicationYear:2015" To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbUrl
    If (Not(IsComObjectCreated(hoSbUrl))) Begin
        Send CreateComObject of hoSbUrl
    End
    Get ComAppend Of hoSbUrl "https://api.scisdata.com/catalogue/api/search?query=" To iSuccess
    // 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..
    Get ComGetEncoded Of hoSbQuery "url" "utf-8" To sTemp1
    Get ComAppend Of hoSbUrl sTemp1 To iSuccess
    Get ComAppend Of hoSbUrl "&from=0&size=20&sort=author&order=asc" To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get ComGetAsString Of hoSbUrl To sTemp1
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp sTemp1 vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // 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

    Get ComIntOf Of hoJResp "data.hits.total" To iDataHitsTotal
    Get ComStringOf Of hoJResp "data.hits.max_score" To sDataHitsMax_score
    Get ComIntOf Of hoJResp "data.took" To iDataTook
    Get ComBoolOf Of hoJResp "data.timed_out" To iDataTimed_out
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "data.hits.hits" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "data.hits.hits[i]._index" To sV_index
        Get ComStringOf Of hoJResp "data.hits.hits[i]._type" To sV_type
        Get ComIntOf Of hoJResp "data.hits.hits[i]._source.dateIssuedMarc" To iV_sourceDateIssuedMarc
        Get ComStringOf Of hoJResp "data.hits.hits[i]._source.isbn13" To sV_sourceIsbn13
        Get ComStringOf Of hoJResp "data.hits.hits[i]._source.imageFileName" To sV_sourceImageFileName
        Get ComStringOf Of hoJResp "data.hits.hits[i]._source.publicationDetails" To sV_sourcePublicationDetails
        Get ComStringOf Of hoJResp "data.hits.hits[i]._source.isbn10" To sV_sourceIsbn10
        Get ComStringOf Of hoJResp "data.hits.hits[i]._source.id" To sV_sourceId
        Get ComStringOf Of hoJResp "data.hits.hits[i]._id" To sV_id
        Get ComStringOf Of hoJResp "data.hits.hits[i]._score" To sV_score
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.isbn" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.isbn[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.languageTermCode" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.languageTermCode[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.mainAuthor.namePersonalPrimary" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.mainAuthor.namePersonalPrimary[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.title.titlePrimary" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.title.titlePrimary[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.title.noteStmOfResponsibility" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.title.noteStmOfResponsibility[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.scisType" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.scisType[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.languageTermValue" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.languageTermValue[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i].sort" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i].sort[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.contributor.namePersonalOther" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.contributor.namePersonalOther[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "data.hits.hits[i]._source.contributor.nameCorporateOther" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "data.hits.hits[i]._source.contributor.nameCorporateOther[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.