Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Cerved API Advanced Entity SearchThe "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/
; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $bSuccess ; 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" ; } $oJson = ObjCreate("Chilkat.JsonObject") ; IMPORTANT: Only include the lines for the search criteria you wish to include. $oJson.UpdateString("search_text","string") $oJson.UpdateString("activity_status_codes[0]","A") $oJson.UpdateString("activity_status_codes[1]","C") $oJson.UpdateString("activity_status_codes[2]","D") $oJson.UpdateString("activity_status_codes[3]","F") $oJson.UpdateString("activity_status_codes[4]","I") $oJson.UpdateString("activity_status_codes[5]","L") $oJson.UpdateString("activity_status_codes[6]","N") $oJson.UpdateString("activity_status_codes[7]","P") $oJson.UpdateString("activity_status_codes[8]","R") $oJson.UpdateString("activity_status_codes[9]","S") $oJson.UpdateString("activity_status_codes[10]","T") $oJson.UpdateString("birth_date","string") $oJson.UpdateString("name","string") $oJson.UpdateString("subject_types[0]","PERSON") $oJson.UpdateString("subject_types[1]","INDIVIDUAL_COMPANY") $oJson.UpdateString("subject_types[2]","COMPANY") $oJson.UpdateString("subject_types[3]","FOREIGN") $oJson.UpdateString("subject_types[4]","OTHER") $oJson.UpdateString("tax_code","string") $oJson.UpdateString("vat_number","string") $oJson.UpdateString("rea.cciaa","string") $oJson.UpdateInt("rea.rea_number",0) $oJson.UpdateString("city_istat_code","string") $oJson.UpdateString("province_code","string") $oHttp.SetRequestHeader "accept","application/json" $oHttp.SetRequestHeader "apikey","********************************" Local $oResp = $oHttp.PostJson3("https://api.cerved.com/cervedApi/v1/entitySearch/advanced","application/json",$oJson) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf $oSbResponseBody = ObjCreate("Chilkat.StringBuilder") $oResp.GetBodySb($oSbResponseBody) $oJResp = ObjCreate("Chilkat.JsonObject") $oJResp.LoadSb($oSbResponseBody) $oJResp.EmitCompact = False ConsoleWrite("Response Body:" & @CRLF) ConsoleWrite($oJResp.Emit() & @CRLF) Local $iRespStatusCode = $oResp.StatusCode ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF) If ($iRespStatusCode >= 400) Then ConsoleWrite("Response Header:" & @CRLF) ConsoleWrite($oResp.Header & @CRLF) ConsoleWrite("Failed." & @CRLF) Exit EndIf ; 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 Local $subject_id Local $subject_type Local $sTax_code Local $sAddressStreetDescription Local $sAddressCityCode Local $sAddressCityIstat_code Local $sAddressCityDescription Local $sAddressProvinceCode Local $sAddressProvinceDescription Local $sAddressPostal_code Local $sAddressCountryCode Local $sAddressCountryDescription Local $sCompany_infoLegal_formCode Local $sCompany_infoLegal_formDescription Local $sCompany_infoLegal_formClass_code Local $sCompany_infoActivity_statusCode Local $sCompany_infoActivity_statusDescription Local $sCompany_infoBusiness_name Local $sCompany_infoEconomic_activityAtecoCode Local $sCompany_infoEconomic_activityAtecoDescription Local $sCompany_infoHead_office Local $sCompany_infoLei_code Local $sCompany_infoOperational_flag Local $sCompany_infoPublic_administrationPa_subject Local $sCompany_infoPublic_administrationPa_supplier Local $sCompany_infoPublic_administrationPa_owned Local $sCompany_infoRea_codeCciaa Local $iCompany_infoRea_codeRea_number Local $sCompany_infoRea_codeRegistration_date Local $sCompany_infoVat_number Local $sCompany_infoNo_rea_dataForm_code Local $sCompany_infoNo_rea_dataForm_description Local $sPerson_infoFirst_name Local $sPerson_infoLast_name Local $sPerson_infoName Local $sPerson_infoBirth_date Local $sPerson_infoBirth_placeStreetDescription Local $sPerson_infoBirth_placeCityCode Local $sPerson_infoBirth_placeCityIstat_code Local $sPerson_infoBirth_placeCityDescription Local $sPerson_infoBirth_placeProvinceCode Local $sPerson_infoBirth_placeProvinceDescription Local $sPerson_infoBirth_placePostal_code Local $sPerson_infoBirth_placeCountryCode Local $sPerson_infoBirth_placeCountryDescription Local $iSubjects_total_number = $oJResp.IntOf("subjects_total_number") Local $i = 0 Local $iCount_i = $oJResp.SizeOfArray("subjects") While $i < $iCount_i $oJResp.I = $i $subject_id = $oJResp.StringOf("subjects[i].subject_id") $subject_type = $oJResp.StringOf("subjects[i].subject_type") $sTax_code = $oJResp.StringOf("subjects[i].tax_code") $sAddressStreetDescription = $oJResp.StringOf("subjects[i].address.street.description") $sAddressCityCode = $oJResp.StringOf("subjects[i].address.city.code") $sAddressCityIstat_code = $oJResp.StringOf("subjects[i].address.city.istat_code") $sAddressCityDescription = $oJResp.StringOf("subjects[i].address.city.description") $sAddressProvinceCode = $oJResp.StringOf("subjects[i].address.province.code") $sAddressProvinceDescription = $oJResp.StringOf("subjects[i].address.province.description") $sAddressPostal_code = $oJResp.StringOf("subjects[i].address.postal_code") $sAddressCountryCode = $oJResp.StringOf("subjects[i].address.country.code") $sAddressCountryDescription = $oJResp.StringOf("subjects[i].address.country.description") $sCompany_infoLegal_formCode = $oJResp.StringOf("subjects[i].company_info.legal_form.code") $sCompany_infoLegal_formDescription = $oJResp.StringOf("subjects[i].company_info.legal_form.description") $sCompany_infoLegal_formClass_code = $oJResp.StringOf("subjects[i].company_info.legal_form.class_code") $sCompany_infoActivity_statusCode = $oJResp.StringOf("subjects[i].company_info.activity_status.code") $sCompany_infoActivity_statusDescription = $oJResp.StringOf("subjects[i].company_info.activity_status.description") $sCompany_infoBusiness_name = $oJResp.StringOf("subjects[i].company_info.business_name") $sCompany_infoEconomic_activityAtecoCode = $oJResp.StringOf("subjects[i].company_info.economic_activity.ateco.code") $sCompany_infoEconomic_activityAtecoDescription = $oJResp.StringOf("subjects[i].company_info.economic_activity.ateco.description") $sCompany_infoHead_office = $oJResp.StringOf("subjects[i].company_info.head_office") $sCompany_infoLei_code = $oJResp.StringOf("subjects[i].company_info.lei_code") $sCompany_infoOperational_flag = $oJResp.StringOf("subjects[i].company_info.operational_flag") $sCompany_infoPublic_administrationPa_subject = $oJResp.StringOf("subjects[i].company_info.public_administration.pa_subject") $sCompany_infoPublic_administrationPa_supplier = $oJResp.StringOf("subjects[i].company_info.public_administration.pa_supplier") $sCompany_infoPublic_administrationPa_owned = $oJResp.StringOf("subjects[i].company_info.public_administration.pa_owned") $sCompany_infoRea_codeCciaa = $oJResp.StringOf("subjects[i].company_info.rea_code.cciaa") $iCompany_infoRea_codeRea_number = $oJResp.IntOf("subjects[i].company_info.rea_code.rea_number") $sCompany_infoRea_codeRegistration_date = $oJResp.StringOf("subjects[i].company_info.rea_code.registration_date") $sCompany_infoVat_number = $oJResp.StringOf("subjects[i].company_info.vat_number") $sCompany_infoNo_rea_dataForm_code = $oJResp.StringOf("subjects[i].company_info.no_rea_data.form_code") $sCompany_infoNo_rea_dataForm_description = $oJResp.StringOf("subjects[i].company_info.no_rea_data.form_description") $sPerson_infoFirst_name = $oJResp.StringOf("subjects[i].person_info.first_name") $sPerson_infoLast_name = $oJResp.StringOf("subjects[i].person_info.last_name") $sPerson_infoName = $oJResp.StringOf("subjects[i].person_info.name") $sPerson_infoBirth_date = $oJResp.StringOf("subjects[i].person_info.birth_date") $sPerson_infoBirth_placeStreetDescription = $oJResp.StringOf("subjects[i].person_info.birth_place.street.description") $sPerson_infoBirth_placeCityCode = $oJResp.StringOf("subjects[i].person_info.birth_place.city.code") $sPerson_infoBirth_placeCityIstat_code = $oJResp.StringOf("subjects[i].person_info.birth_place.city.istat_code") $sPerson_infoBirth_placeCityDescription = $oJResp.StringOf("subjects[i].person_info.birth_place.city.description") $sPerson_infoBirth_placeProvinceCode = $oJResp.StringOf("subjects[i].person_info.birth_place.province.code") $sPerson_infoBirth_placeProvinceDescription = $oJResp.StringOf("subjects[i].person_info.birth_place.province.description") $sPerson_infoBirth_placePostal_code = $oJResp.StringOf("subjects[i].person_info.birth_place.postal_code") $sPerson_infoBirth_placeCountryCode = $oJResp.StringOf("subjects[i].person_info.birth_place.country.code") $sPerson_infoBirth_placeCountryDescription = $oJResp.StringOf("subjects[i].person_info.birth_place.country.description") $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.