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
(Delphi ActiveX) 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/
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB; ... procedure TForm1.Button1Click(Sender: TObject); var http: TChilkatHttp; success: Integer; json: TChilkatJsonObject; resp: IChilkatHttpResponse; sbResponseBody: TChilkatStringBuilder; jResp: TChilkatJsonObject; respStatusCode: Integer; subject_id: WideString; subject_type: WideString; tax_code: WideString; addressStreetDescription: WideString; addressCityCode: WideString; addressCityIstat_code: WideString; addressCityDescription: WideString; addressProvinceCode: WideString; addressProvinceDescription: WideString; addressPostal_code: WideString; addressCountryCode: WideString; addressCountryDescription: WideString; company_infoLegal_formCode: WideString; company_infoLegal_formDescription: WideString; company_infoLegal_formClass_code: WideString; company_infoActivity_statusCode: WideString; company_infoActivity_statusDescription: WideString; company_infoBusiness_name: WideString; company_infoEconomic_activityAtecoCode: WideString; company_infoEconomic_activityAtecoDescription: WideString; company_infoHead_office: WideString; company_infoLei_code: WideString; company_infoOperational_flag: WideString; company_infoPublic_administrationPa_subject: WideString; company_infoPublic_administrationPa_supplier: WideString; company_infoPublic_administrationPa_owned: WideString; company_infoRea_codeCciaa: WideString; company_infoRea_codeRea_number: Integer; company_infoRea_codeRegistration_date: WideString; company_infoVat_number: WideString; company_infoNo_rea_dataForm_code: WideString; company_infoNo_rea_dataForm_description: WideString; person_infoFirst_name: WideString; person_infoLast_name: WideString; person_infoName: WideString; person_infoBirth_date: WideString; person_infoBirth_placeStreetDescription: WideString; person_infoBirth_placeCityCode: WideString; person_infoBirth_placeCityIstat_code: WideString; person_infoBirth_placeCityDescription: WideString; person_infoBirth_placeProvinceCode: WideString; person_infoBirth_placeProvinceDescription: WideString; person_infoBirth_placePostal_code: WideString; person_infoBirth_placeCountryCode: WideString; person_infoBirth_placeCountryDescription: WideString; subjects_total_number: Integer; i: Integer; count_i: Integer; begin // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http := TChilkatHttp.Create(Self); // 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" // } json := TChilkatJsonObject.Create(Self); // IMPORTANT: Only include the lines for the search criteria you wish to include. json.UpdateString('search_text','string'); json.UpdateString('activity_status_codes[0]','A'); json.UpdateString('activity_status_codes[1]','C'); json.UpdateString('activity_status_codes[2]','D'); json.UpdateString('activity_status_codes[3]','F'); json.UpdateString('activity_status_codes[4]','I'); json.UpdateString('activity_status_codes[5]','L'); json.UpdateString('activity_status_codes[6]','N'); json.UpdateString('activity_status_codes[7]','P'); json.UpdateString('activity_status_codes[8]','R'); json.UpdateString('activity_status_codes[9]','S'); json.UpdateString('activity_status_codes[10]','T'); json.UpdateString('birth_date','string'); json.UpdateString('name','string'); json.UpdateString('subject_types[0]','PERSON'); json.UpdateString('subject_types[1]','INDIVIDUAL_COMPANY'); json.UpdateString('subject_types[2]','COMPANY'); json.UpdateString('subject_types[3]','FOREIGN'); json.UpdateString('subject_types[4]','OTHER'); json.UpdateString('tax_code','string'); json.UpdateString('vat_number','string'); json.UpdateString('rea.cciaa','string'); json.UpdateInt('rea.rea_number',0); json.UpdateString('city_istat_code','string'); json.UpdateString('province_code','string'); http.SetRequestHeader('accept','application/json'); http.SetRequestHeader('apikey','********************************'); resp := http.PostJson3('https://api.cerved.com/cervedApi/v1/entitySearch/advanced','application/json',json.ControlInterface); if (http.LastMethodSuccess = 0) then begin Memo1.Lines.Add(http.LastErrorText); Exit; end; sbResponseBody := TChilkatStringBuilder.Create(Self); resp.GetBodySb(sbResponseBody.ControlInterface); jResp := TChilkatJsonObject.Create(Self); jResp.LoadSb(sbResponseBody.ControlInterface); jResp.EmitCompact := 0; Memo1.Lines.Add('Response Body:'); Memo1.Lines.Add(jResp.Emit()); respStatusCode := resp.StatusCode; Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode)); if (respStatusCode >= 400) then begin Memo1.Lines.Add('Response Header:'); Memo1.Lines.Add(resp.Header); Memo1.Lines.Add('Failed.'); Exit; end; // 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 subjects_total_number := jResp.IntOf('subjects_total_number'); i := 0; count_i := jResp.SizeOfArray('subjects'); while i < count_i do begin jResp.I := i; subject_id := jResp.StringOf('subjects[i].subject_id'); subject_type := jResp.StringOf('subjects[i].subject_type'); tax_code := jResp.StringOf('subjects[i].tax_code'); addressStreetDescription := jResp.StringOf('subjects[i].address.street.description'); addressCityCode := jResp.StringOf('subjects[i].address.city.code'); addressCityIstat_code := jResp.StringOf('subjects[i].address.city.istat_code'); addressCityDescription := jResp.StringOf('subjects[i].address.city.description'); addressProvinceCode := jResp.StringOf('subjects[i].address.province.code'); addressProvinceDescription := jResp.StringOf('subjects[i].address.province.description'); addressPostal_code := jResp.StringOf('subjects[i].address.postal_code'); addressCountryCode := jResp.StringOf('subjects[i].address.country.code'); addressCountryDescription := jResp.StringOf('subjects[i].address.country.description'); company_infoLegal_formCode := jResp.StringOf('subjects[i].company_info.legal_form.code'); company_infoLegal_formDescription := jResp.StringOf('subjects[i].company_info.legal_form.description'); company_infoLegal_formClass_code := jResp.StringOf('subjects[i].company_info.legal_form.class_code'); company_infoActivity_statusCode := jResp.StringOf('subjects[i].company_info.activity_status.code'); company_infoActivity_statusDescription := jResp.StringOf('subjects[i].company_info.activity_status.description'); company_infoBusiness_name := jResp.StringOf('subjects[i].company_info.business_name'); company_infoEconomic_activityAtecoCode := jResp.StringOf('subjects[i].company_info.economic_activity.ateco.code'); company_infoEconomic_activityAtecoDescription := jResp.StringOf('subjects[i].company_info.economic_activity.ateco.description'); company_infoHead_office := jResp.StringOf('subjects[i].company_info.head_office'); company_infoLei_code := jResp.StringOf('subjects[i].company_info.lei_code'); company_infoOperational_flag := jResp.StringOf('subjects[i].company_info.operational_flag'); company_infoPublic_administrationPa_subject := jResp.StringOf('subjects[i].company_info.public_administration.pa_subject'); company_infoPublic_administrationPa_supplier := jResp.StringOf('subjects[i].company_info.public_administration.pa_supplier'); company_infoPublic_administrationPa_owned := jResp.StringOf('subjects[i].company_info.public_administration.pa_owned'); company_infoRea_codeCciaa := jResp.StringOf('subjects[i].company_info.rea_code.cciaa'); company_infoRea_codeRea_number := jResp.IntOf('subjects[i].company_info.rea_code.rea_number'); company_infoRea_codeRegistration_date := jResp.StringOf('subjects[i].company_info.rea_code.registration_date'); company_infoVat_number := jResp.StringOf('subjects[i].company_info.vat_number'); company_infoNo_rea_dataForm_code := jResp.StringOf('subjects[i].company_info.no_rea_data.form_code'); company_infoNo_rea_dataForm_description := jResp.StringOf('subjects[i].company_info.no_rea_data.form_description'); person_infoFirst_name := jResp.StringOf('subjects[i].person_info.first_name'); person_infoLast_name := jResp.StringOf('subjects[i].person_info.last_name'); person_infoName := jResp.StringOf('subjects[i].person_info.name'); person_infoBirth_date := jResp.StringOf('subjects[i].person_info.birth_date'); person_infoBirth_placeStreetDescription := jResp.StringOf('subjects[i].person_info.birth_place.street.description'); person_infoBirth_placeCityCode := jResp.StringOf('subjects[i].person_info.birth_place.city.code'); person_infoBirth_placeCityIstat_code := jResp.StringOf('subjects[i].person_info.birth_place.city.istat_code'); person_infoBirth_placeCityDescription := jResp.StringOf('subjects[i].person_info.birth_place.city.description'); person_infoBirth_placeProvinceCode := jResp.StringOf('subjects[i].person_info.birth_place.province.code'); person_infoBirth_placeProvinceDescription := jResp.StringOf('subjects[i].person_info.birth_place.province.description'); person_infoBirth_placePostal_code := jResp.StringOf('subjects[i].person_info.birth_place.postal_code'); person_infoBirth_placeCountryCode := jResp.StringOf('subjects[i].person_info.birth_place.country.code'); person_infoBirth_placeCountryDescription := jResp.StringOf('subjects[i].person_info.birth_place.country.description'); i := i + 1; end; end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.