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

Delphi DLL Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Bitfinex v2 REST
Bluzone
BrickLink
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Mastercard

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

 

 

 

(Delphi DLL) 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 for Delphi Downloads

Chilkat non-ActiveX DLL for Delphi

Chilkat ActiveX DLL for Delphi

* The examples here use the non-ActiveX DLL.

uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, StringBuilder, HttpResponse, JsonObject;

...

procedure TForm1.Button1Click(Sender: TObject);
var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
resp: HCkHttpResponse;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
subject_id: PWideChar;
subject_type: PWideChar;
tax_code: PWideChar;
addressStreetDescription: PWideChar;
addressCityCode: PWideChar;
addressCityIstat_code: PWideChar;
addressCityDescription: PWideChar;
addressProvinceCode: PWideChar;
addressProvinceDescription: PWideChar;
addressPostal_code: PWideChar;
addressCountryCode: PWideChar;
addressCountryDescription: PWideChar;
company_infoLegal_formCode: PWideChar;
company_infoLegal_formDescription: PWideChar;
company_infoLegal_formClass_code: PWideChar;
company_infoActivity_statusCode: PWideChar;
company_infoActivity_statusDescription: PWideChar;
company_infoBusiness_name: PWideChar;
company_infoEconomic_activityAtecoCode: PWideChar;
company_infoEconomic_activityAtecoDescription: PWideChar;
company_infoHead_office: PWideChar;
company_infoLei_code: PWideChar;
company_infoOperational_flag: PWideChar;
company_infoPublic_administrationPa_subject: PWideChar;
company_infoPublic_administrationPa_supplier: PWideChar;
company_infoPublic_administrationPa_owned: PWideChar;
company_infoRea_codeCciaa: PWideChar;
company_infoRea_codeRea_number: Integer;
company_infoRea_codeRegistration_date: PWideChar;
company_infoVat_number: PWideChar;
company_infoNo_rea_dataForm_code: PWideChar;
company_infoNo_rea_dataForm_description: PWideChar;
person_infoFirst_name: PWideChar;
person_infoLast_name: PWideChar;
person_infoName: PWideChar;
person_infoBirth_date: PWideChar;
person_infoBirth_placeStreetDescription: PWideChar;
person_infoBirth_placeCityCode: PWideChar;
person_infoBirth_placeCityIstat_code: PWideChar;
person_infoBirth_placeCityDescription: PWideChar;
person_infoBirth_placeProvinceCode: PWideChar;
person_infoBirth_placeProvinceDescription: PWideChar;
person_infoBirth_placePostal_code: PWideChar;
person_infoBirth_placeCountryCode: PWideChar;
person_infoBirth_placeCountryDescription: PWideChar;
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 := CkHttp_Create();

// 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 := CkJsonObject_Create();
// IMPORTANT:  Only include the lines for the search criteria you wish to include.
CkJsonObject_UpdateString(json,'search_text','string');
CkJsonObject_UpdateString(json,'activity_status_codes[0]','A');
CkJsonObject_UpdateString(json,'activity_status_codes[1]','C');
CkJsonObject_UpdateString(json,'activity_status_codes[2]','D');
CkJsonObject_UpdateString(json,'activity_status_codes[3]','F');
CkJsonObject_UpdateString(json,'activity_status_codes[4]','I');
CkJsonObject_UpdateString(json,'activity_status_codes[5]','L');
CkJsonObject_UpdateString(json,'activity_status_codes[6]','N');
CkJsonObject_UpdateString(json,'activity_status_codes[7]','P');
CkJsonObject_UpdateString(json,'activity_status_codes[8]','R');
CkJsonObject_UpdateString(json,'activity_status_codes[9]','S');
CkJsonObject_UpdateString(json,'activity_status_codes[10]','T');
CkJsonObject_UpdateString(json,'birth_date','string');
CkJsonObject_UpdateString(json,'name','string');
CkJsonObject_UpdateString(json,'subject_types[0]','PERSON');
CkJsonObject_UpdateString(json,'subject_types[1]','INDIVIDUAL_COMPANY');
CkJsonObject_UpdateString(json,'subject_types[2]','COMPANY');
CkJsonObject_UpdateString(json,'subject_types[3]','FOREIGN');
CkJsonObject_UpdateString(json,'subject_types[4]','OTHER');
CkJsonObject_UpdateString(json,'tax_code','string');
CkJsonObject_UpdateString(json,'vat_number','string');
CkJsonObject_UpdateString(json,'rea.cciaa','string');
CkJsonObject_UpdateInt(json,'rea.rea_number',0);
CkJsonObject_UpdateString(json,'city_istat_code','string');
CkJsonObject_UpdateString(json,'province_code','string');

CkHttp_SetRequestHeader(http,'accept','application/json');
CkHttp_SetRequestHeader(http,'apikey','********************************');

resp := CkHttp_PostJson3(http,'https://api.cerved.com/cervedApi/v1/entitySearch/advanced','application/json',json);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

sbResponseBody := CkStringBuilder_Create();
CkHttpResponse_GetBodySb(resp,sbResponseBody);
jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);

Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));

respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttpResponse__header(resp));
    Memo1.Lines.Add('Failed.');
    CkHttpResponse_Dispose(resp);
    Exit;
  end;
CkHttpResponse_Dispose(resp);

// 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 := CkJsonObject_IntOf(jResp,'subjects_total_number');
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'subjects');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    subject_id := CkJsonObject__stringOf(jResp,'subjects[i].subject_id');
    subject_type := CkJsonObject__stringOf(jResp,'subjects[i].subject_type');
    tax_code := CkJsonObject__stringOf(jResp,'subjects[i].tax_code');
    addressStreetDescription := CkJsonObject__stringOf(jResp,'subjects[i].address.street.description');
    addressCityCode := CkJsonObject__stringOf(jResp,'subjects[i].address.city.code');
    addressCityIstat_code := CkJsonObject__stringOf(jResp,'subjects[i].address.city.istat_code');
    addressCityDescription := CkJsonObject__stringOf(jResp,'subjects[i].address.city.description');
    addressProvinceCode := CkJsonObject__stringOf(jResp,'subjects[i].address.province.code');
    addressProvinceDescription := CkJsonObject__stringOf(jResp,'subjects[i].address.province.description');
    addressPostal_code := CkJsonObject__stringOf(jResp,'subjects[i].address.postal_code');
    addressCountryCode := CkJsonObject__stringOf(jResp,'subjects[i].address.country.code');
    addressCountryDescription := CkJsonObject__stringOf(jResp,'subjects[i].address.country.description');
    company_infoLegal_formCode := CkJsonObject__stringOf(jResp,'subjects[i].company_info.legal_form.code');
    company_infoLegal_formDescription := CkJsonObject__stringOf(jResp,'subjects[i].company_info.legal_form.description');
    company_infoLegal_formClass_code := CkJsonObject__stringOf(jResp,'subjects[i].company_info.legal_form.class_code');
    company_infoActivity_statusCode := CkJsonObject__stringOf(jResp,'subjects[i].company_info.activity_status.code');
    company_infoActivity_statusDescription := CkJsonObject__stringOf(jResp,'subjects[i].company_info.activity_status.description');
    company_infoBusiness_name := CkJsonObject__stringOf(jResp,'subjects[i].company_info.business_name');
    company_infoEconomic_activityAtecoCode := CkJsonObject__stringOf(jResp,'subjects[i].company_info.economic_activity.ateco.code');
    company_infoEconomic_activityAtecoDescription := CkJsonObject__stringOf(jResp,'subjects[i].company_info.economic_activity.ateco.description');
    company_infoHead_office := CkJsonObject__stringOf(jResp,'subjects[i].company_info.head_office');
    company_infoLei_code := CkJsonObject__stringOf(jResp,'subjects[i].company_info.lei_code');
    company_infoOperational_flag := CkJsonObject__stringOf(jResp,'subjects[i].company_info.operational_flag');
    company_infoPublic_administrationPa_subject := CkJsonObject__stringOf(jResp,'subjects[i].company_info.public_administration.pa_subject');
    company_infoPublic_administrationPa_supplier := CkJsonObject__stringOf(jResp,'subjects[i].company_info.public_administration.pa_supplier');
    company_infoPublic_administrationPa_owned := CkJsonObject__stringOf(jResp,'subjects[i].company_info.public_administration.pa_owned');
    company_infoRea_codeCciaa := CkJsonObject__stringOf(jResp,'subjects[i].company_info.rea_code.cciaa');
    company_infoRea_codeRea_number := CkJsonObject_IntOf(jResp,'subjects[i].company_info.rea_code.rea_number');
    company_infoRea_codeRegistration_date := CkJsonObject__stringOf(jResp,'subjects[i].company_info.rea_code.registration_date');
    company_infoVat_number := CkJsonObject__stringOf(jResp,'subjects[i].company_info.vat_number');
    company_infoNo_rea_dataForm_code := CkJsonObject__stringOf(jResp,'subjects[i].company_info.no_rea_data.form_code');
    company_infoNo_rea_dataForm_description := CkJsonObject__stringOf(jResp,'subjects[i].company_info.no_rea_data.form_description');
    person_infoFirst_name := CkJsonObject__stringOf(jResp,'subjects[i].person_info.first_name');
    person_infoLast_name := CkJsonObject__stringOf(jResp,'subjects[i].person_info.last_name');
    person_infoName := CkJsonObject__stringOf(jResp,'subjects[i].person_info.name');
    person_infoBirth_date := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_date');
    person_infoBirth_placeStreetDescription := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.street.description');
    person_infoBirth_placeCityCode := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.city.code');
    person_infoBirth_placeCityIstat_code := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.city.istat_code');
    person_infoBirth_placeCityDescription := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.city.description');
    person_infoBirth_placeProvinceCode := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.province.code');
    person_infoBirth_placeProvinceDescription := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.province.description');
    person_infoBirth_placePostal_code := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.postal_code');
    person_infoBirth_placeCountryCode := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.country.code');
    person_infoBirth_placeCountryDescription := CkJsonObject__stringOf(jResp,'subjects[i].person_info.birth_place.country.description');
    i := i + 1;
  end;

CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);

end;

 

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