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

Swift 3,4,5... 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

 

 

 

(Swift 3,4,5...) Cerved API Advanced Entity Search

The "Advanced Entity Search" API allows you to find subjects in the Cerved database that meet specific search criteria, specified through the parameters provided as input to the service.

For more information, see https://apps-developer.cerved.com/

Chilkat Downloads for the Swift Programming Language

MAC OS X (Cocoa) Objective-C/Swift Libs

iOS Objective-C/Swift Libs

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

    let http = CkoHttp()!
    var success: Bool

    // Implements the following CURL command:

    // curl -X POST \
    //   https://api.cerved.com/cervedApi/v1/entitySearch/advanced \
    //   -H 'accept: application/json' \
    //   -H 'apikey: ********************************' \
    // -d '{
    //   "search_text": "string",
    //   "activity_status_codes": [
    //     "A",
    //     "C",
    //     "D",
    //     "F",
    //     "I",
    //     "L",
    //     "N",
    //     "P",
    //     "R",
    //     "S",
    //     "T"
    //   ],
    //   "birth_date": "string",
    //   "name": "string",
    //   "subject_types": [
    //     "PERSON",
    //     "INDIVIDUAL_COMPANY",
    //     "COMPANY",
    //     "FOREIGN",
    //     "OTHER"
    //   ],
    //   "tax_code": "string",
    //   "vat_number": "string",
    //   "rea": {
    //     "cciaa": "string",
    //     "rea_number": 0
    //   },
    //   "city_istat_code": "string",
    //   "province_code": "string"
    // }'

    // Use the following online tool to generate HTTP code from a CURL command
    // Convert a cURL Command to HTTP Source Code

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "search_text": "string",
    //   "activity_status_codes": [
    //     "A",
    //     "C",
    //     "D",
    //     "F",
    //     "I",
    //     "L",
    //     "N",
    //     "P",
    //     "R",
    //     "S",
    //     "T"
    //   ],
    //   "birth_date": "string",
    //   "name": "string",
    //   "subject_types": [
    //     "PERSON",
    //     "INDIVIDUAL_COMPANY",
    //     "COMPANY",
    //     "FOREIGN",
    //     "OTHER"
    //   ],
    //   "tax_code": "string",
    //   "vat_number": "string",
    //   "rea": {
    //     "cciaa": "string",
    //     "rea_number": 0
    //   },
    //   "city_istat_code": "string",
    //   "province_code": "string"
    // }

    let json = CkoJsonObject()!
    // IMPORTANT:  Only include the lines for the search criteria you wish to include.
    json.update("search_text", value: "string")
    json.update("activity_status_codes[0]", value: "A")
    json.update("activity_status_codes[1]", value: "C")
    json.update("activity_status_codes[2]", value: "D")
    json.update("activity_status_codes[3]", value: "F")
    json.update("activity_status_codes[4]", value: "I")
    json.update("activity_status_codes[5]", value: "L")
    json.update("activity_status_codes[6]", value: "N")
    json.update("activity_status_codes[7]", value: "P")
    json.update("activity_status_codes[8]", value: "R")
    json.update("activity_status_codes[9]", value: "S")
    json.update("activity_status_codes[10]", value: "T")
    json.update("birth_date", value: "string")
    json.update("name", value: "string")
    json.update("subject_types[0]", value: "PERSON")
    json.update("subject_types[1]", value: "INDIVIDUAL_COMPANY")
    json.update("subject_types[2]", value: "COMPANY")
    json.update("subject_types[3]", value: "FOREIGN")
    json.update("subject_types[4]", value: "OTHER")
    json.update("tax_code", value: "string")
    json.update("vat_number", value: "string")
    json.update("rea.cciaa", value: "string")
    json.updateInt("rea.rea_number", value: 0)
    json.update("city_istat_code", value: "string")
    json.update("province_code", value: "string")

    http.setRequestHeader("accept", value: "application/json")
    http.setRequestHeader("apikey", value: "********************************")

    var resp: CkoHttpResponse? = http.postJson3("https://api.cerved.com/cervedApi/v1/entitySearch/advanced", contentType: "application/json", json: json)
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    let sbResponseBody = CkoStringBuilder()!
    resp!.getBodySb(sbResponseBody)
    let jResp = CkoJsonObject()!
    jResp.loadSb(sbResponseBody)
    jResp.emitCompact = false

    print("Response Body:")
    print("\(jResp.emit()!)")

    var respStatusCode: Int = resp!.statusCode.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode >= 400 {
        print("Response Header:")
        print("\(resp!.header!)")
        print("Failed.")
        resp = nil
        return
    }

    resp = nil

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

    // {
    //   "subjects": [
    //     {
    //       "subject_id": "string",
    //       "subject_type": "string",
    //       "tax_code": "string",
    //       "address": {
    //         "street": {
    //           "description": "string"
    //         },
    //         "city": {
    //           "code": "string",
    //           "istat_code": "string",
    //           "description": "string"
    //         },
    //         "province": {
    //           "code": "string",
    //           "description": "string"
    //         },
    //         "postal_code": "string",
    //         "country": {
    //           "code": "string",
    //           "description": "string"
    //         }
    //       },
    //       "company_info": {
    //         "legal_form": {
    //           "code": "string",
    //           "description": "string",
    //           "class_code": "string"
    //         },
    //         "activity_status": {
    //           "code": "string",
    //           "description": "string"
    //         },
    //         "business_name": "string",
    //         "economic_activity": {
    //           "ateco": {
    //             "code": "string",
    //             "description": "string"
    //           }
    //         },
    //         "head_office": "true",
    //         "lei_code": "string",
    //         "operational_flag": "true",
    //         "public_administration": {
    //           "pa_subject": "true",
    //           "pa_supplier": "true",
    //           "pa_owned": "true"
    //         },
    //         "rea_code": {
    //           "cciaa": "string",
    //           "rea_number": 0,
    //           "registration_date": "string"
    //         },
    //         "vat_number": "string",
    //         "no_rea_data": {
    //           "form_code": "string",
    //           "form_description": "string"
    //         }
    //       },
    //       "person_info": {
    //         "first_name": "string",
    //         "last_name": "string",
    //         "name": "string",
    //         "birth_date": "string",
    //         "birth_place": {
    //           "street": {
    //             "description": "string"
    //           },
    //           "city": {
    //             "code": "string",
    //             "istat_code": "string",
    //             "description": "string"
    //           },
    //           "province": {
    //             "code": "string",
    //             "description": "string"
    //           },
    //           "postal_code": "string",
    //           "country": {
    //             "code": "string",
    //             "description": "string"
    //           }
    //         }
    //       }
    //     }
    //   ],
    //   "subjects_total_number": 0
    // }

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

    var subject_id: String?
    var subject_type: String?
    var tax_code: String?
    var addressStreetDescription: String?
    var addressCityCode: String?
    var addressCityIstat_code: String?
    var addressCityDescription: String?
    var addressProvinceCode: String?
    var addressProvinceDescription: String?
    var addressPostal_code: String?
    var addressCountryCode: String?
    var addressCountryDescription: String?
    var company_infoLegal_formCode: String?
    var company_infoLegal_formDescription: String?
    var company_infoLegal_formClass_code: String?
    var company_infoActivity_statusCode: String?
    var company_infoActivity_statusDescription: String?
    var company_infoBusiness_name: String?
    var company_infoEconomic_activityAtecoCode: String?
    var company_infoEconomic_activityAtecoDescription: String?
    var company_infoHead_office: String?
    var company_infoLei_code: String?
    var company_infoOperational_flag: String?
    var company_infoPublic_administrationPa_subject: String?
    var company_infoPublic_administrationPa_supplier: String?
    var company_infoPublic_administrationPa_owned: String?
    var company_infoRea_codeCciaa: String?
    var company_infoRea_codeRea_number: Int
    var company_infoRea_codeRegistration_date: String?
    var company_infoVat_number: String?
    var company_infoNo_rea_dataForm_code: String?
    var company_infoNo_rea_dataForm_description: String?
    var person_infoFirst_name: String?
    var person_infoLast_name: String?
    var person_infoName: String?
    var person_infoBirth_date: String?
    var person_infoBirth_placeStreetDescription: String?
    var person_infoBirth_placeCityCode: String?
    var person_infoBirth_placeCityIstat_code: String?
    var person_infoBirth_placeCityDescription: String?
    var person_infoBirth_placeProvinceCode: String?
    var person_infoBirth_placeProvinceDescription: String?
    var person_infoBirth_placePostal_code: String?
    var person_infoBirth_placeCountryCode: String?
    var person_infoBirth_placeCountryDescription: String?

    var subjects_total_number: Int = jResp.int(of: "subjects_total_number").intValue
    var i: Int = 0
    var count_i: Int = jResp.size(ofArray: "subjects").intValue
    while i < count_i {
        jResp.i = i
        subject_id = jResp.string(of: "subjects[i].subject_id")
        subject_type = jResp.string(of: "subjects[i].subject_type")
        tax_code = jResp.string(of: "subjects[i].tax_code")
        addressStreetDescription = jResp.string(of: "subjects[i].address.street.description")
        addressCityCode = jResp.string(of: "subjects[i].address.city.code")
        addressCityIstat_code = jResp.string(of: "subjects[i].address.city.istat_code")
        addressCityDescription = jResp.string(of: "subjects[i].address.city.description")
        addressProvinceCode = jResp.string(of: "subjects[i].address.province.code")
        addressProvinceDescription = jResp.string(of: "subjects[i].address.province.description")
        addressPostal_code = jResp.string(of: "subjects[i].address.postal_code")
        addressCountryCode = jResp.string(of: "subjects[i].address.country.code")
        addressCountryDescription = jResp.string(of: "subjects[i].address.country.description")
        company_infoLegal_formCode = jResp.string(of: "subjects[i].company_info.legal_form.code")
        company_infoLegal_formDescription = jResp.string(of: "subjects[i].company_info.legal_form.description")
        company_infoLegal_formClass_code = jResp.string(of: "subjects[i].company_info.legal_form.class_code")
        company_infoActivity_statusCode = jResp.string(of: "subjects[i].company_info.activity_status.code")
        company_infoActivity_statusDescription = jResp.string(of: "subjects[i].company_info.activity_status.description")
        company_infoBusiness_name = jResp.string(of: "subjects[i].company_info.business_name")
        company_infoEconomic_activityAtecoCode = jResp.string(of: "subjects[i].company_info.economic_activity.ateco.code")
        company_infoEconomic_activityAtecoDescription = jResp.string(of: "subjects[i].company_info.economic_activity.ateco.description")
        company_infoHead_office = jResp.string(of: "subjects[i].company_info.head_office")
        company_infoLei_code = jResp.string(of: "subjects[i].company_info.lei_code")
        company_infoOperational_flag = jResp.string(of: "subjects[i].company_info.operational_flag")
        company_infoPublic_administrationPa_subject = jResp.string(of: "subjects[i].company_info.public_administration.pa_subject")
        company_infoPublic_administrationPa_supplier = jResp.string(of: "subjects[i].company_info.public_administration.pa_supplier")
        company_infoPublic_administrationPa_owned = jResp.string(of: "subjects[i].company_info.public_administration.pa_owned")
        company_infoRea_codeCciaa = jResp.string(of: "subjects[i].company_info.rea_code.cciaa")
        company_infoRea_codeRea_number = jResp.int(of: "subjects[i].company_info.rea_code.rea_number").intValue
        company_infoRea_codeRegistration_date = jResp.string(of: "subjects[i].company_info.rea_code.registration_date")
        company_infoVat_number = jResp.string(of: "subjects[i].company_info.vat_number")
        company_infoNo_rea_dataForm_code = jResp.string(of: "subjects[i].company_info.no_rea_data.form_code")
        company_infoNo_rea_dataForm_description = jResp.string(of: "subjects[i].company_info.no_rea_data.form_description")
        person_infoFirst_name = jResp.string(of: "subjects[i].person_info.first_name")
        person_infoLast_name = jResp.string(of: "subjects[i].person_info.last_name")
        person_infoName = jResp.string(of: "subjects[i].person_info.name")
        person_infoBirth_date = jResp.string(of: "subjects[i].person_info.birth_date")
        person_infoBirth_placeStreetDescription = jResp.string(of: "subjects[i].person_info.birth_place.street.description")
        person_infoBirth_placeCityCode = jResp.string(of: "subjects[i].person_info.birth_place.city.code")
        person_infoBirth_placeCityIstat_code = jResp.string(of: "subjects[i].person_info.birth_place.city.istat_code")
        person_infoBirth_placeCityDescription = jResp.string(of: "subjects[i].person_info.birth_place.city.description")
        person_infoBirth_placeProvinceCode = jResp.string(of: "subjects[i].person_info.birth_place.province.code")
        person_infoBirth_placeProvinceDescription = jResp.string(of: "subjects[i].person_info.birth_place.province.description")
        person_infoBirth_placePostal_code = jResp.string(of: "subjects[i].person_info.birth_place.postal_code")
        person_infoBirth_placeCountryCode = jResp.string(of: "subjects[i].person_info.birth_place.country.code")
        person_infoBirth_placeCountryDescription = jResp.string(of: "subjects[i].person_info.birth_place.country.description")
        i = i + 1
    }


}

 

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