Dart
Dart
Cerved API Advanced Entity Search
See more Cerved Examples
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.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
// 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"
// }
final json = CkJsonObject();
// 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', '********************************');
final resp = CkHttpResponse();
try {
http.httpJson('POST', 'https://api.cerved.com/cervedApi/v1/entitySearch/advanced', json, 'application/json', resp);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final sbResponseBody = CkStringBuilder();
resp.getBodySb(sbResponseBody);
final jResp = CkJsonObject();
jResp.loadSb(sbResponseBody);
jResp.emitCompact = false;
print('Response Body:');
print(jResp.emit());
final respStatusCode = resp.statusCode;
print('Response Status Code = $respStatusCode');
if (respStatusCode >= 400) {
print('Response Header:');
print(resp.header);
print('Failed.');
return;
}
// 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 subjectId = '';
var subjectType = '';
var taxCode = '';
var addressStreetDescription = '';
var addressCityCode = '';
var addressCityIstatCode = '';
var addressCityDescription = '';
var addressProvinceCode = '';
var addressProvinceDescription = '';
var addressPostalCode = '';
var addressCountryCode = '';
var addressCountryDescription = '';
var companyInfoLegalFormCode = '';
var companyInfoLegalFormDescription = '';
var companyInfoLegalFormClassCode = '';
var companyInfoActivityStatusCode = '';
var companyInfoActivityStatusDescription = '';
var companyInfoBusinessName = '';
var companyInfoEconomicActivityAtecoCode = '';
var companyInfoEconomicActivityAtecoDescription = '';
var companyInfoHeadOffice = '';
var companyInfoLeiCode = '';
var companyInfoOperationalFlag = '';
var companyInfoPublicAdministrationPaSubject = '';
var companyInfoPublicAdministrationPaSupplier = '';
var companyInfoPublicAdministrationPaOwned = '';
var companyInfoReaCodeCciaa = '';
var companyInfoReaCodeReaNumber = 0;
var companyInfoReaCodeRegistrationDate = '';
var companyInfoVatNumber = '';
var companyInfoNoReaDataFormCode = '';
var companyInfoNoReaDataFormDescription = '';
var personInfoFirstName = '';
var personInfoLastName = '';
var personInfoName = '';
var personInfoBirthDate = '';
var personInfoBirthPlaceStreetDescription = '';
var personInfoBirthPlaceCityCode = '';
var personInfoBirthPlaceCityIstatCode = '';
var personInfoBirthPlaceCityDescription = '';
var personInfoBirthPlaceProvinceCode = '';
var personInfoBirthPlaceProvinceDescription = '';
var personInfoBirthPlacePostalCode = '';
var personInfoBirthPlaceCountryCode = '';
var personInfoBirthPlaceCountryDescription = '';
final subjectsTotalNumber = jResp.intOf('subjects_total_number');
var i = 0;
final countI = jResp.sizeOfArray('subjects');
while (i < countI) {
jResp.i = i;
subjectId = jResp.stringOf('subjects[i].subject_id');
subjectType = jResp.stringOf('subjects[i].subject_type');
taxCode = jResp.stringOf('subjects[i].tax_code');
addressStreetDescription = jResp.stringOf('subjects[i].address.street.description');
addressCityCode = jResp.stringOf('subjects[i].address.city.code');
addressCityIstatCode = 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');
addressPostalCode = jResp.stringOf('subjects[i].address.postal_code');
addressCountryCode = jResp.stringOf('subjects[i].address.country.code');
addressCountryDescription = jResp.stringOf('subjects[i].address.country.description');
companyInfoLegalFormCode = jResp.stringOf('subjects[i].company_info.legal_form.code');
companyInfoLegalFormDescription = jResp.stringOf('subjects[i].company_info.legal_form.description');
companyInfoLegalFormClassCode = jResp.stringOf('subjects[i].company_info.legal_form.class_code');
companyInfoActivityStatusCode = jResp.stringOf('subjects[i].company_info.activity_status.code');
companyInfoActivityStatusDescription = jResp.stringOf('subjects[i].company_info.activity_status.description');
companyInfoBusinessName = jResp.stringOf('subjects[i].company_info.business_name');
companyInfoEconomicActivityAtecoCode = jResp.stringOf('subjects[i].company_info.economic_activity.ateco.code');
companyInfoEconomicActivityAtecoDescription = jResp.stringOf('subjects[i].company_info.economic_activity.ateco.description');
companyInfoHeadOffice = jResp.stringOf('subjects[i].company_info.head_office');
companyInfoLeiCode = jResp.stringOf('subjects[i].company_info.lei_code');
companyInfoOperationalFlag = jResp.stringOf('subjects[i].company_info.operational_flag');
companyInfoPublicAdministrationPaSubject = jResp.stringOf('subjects[i].company_info.public_administration.pa_subject');
companyInfoPublicAdministrationPaSupplier = jResp.stringOf('subjects[i].company_info.public_administration.pa_supplier');
companyInfoPublicAdministrationPaOwned = jResp.stringOf('subjects[i].company_info.public_administration.pa_owned');
companyInfoReaCodeCciaa = jResp.stringOf('subjects[i].company_info.rea_code.cciaa');
companyInfoReaCodeReaNumber = jResp.intOf('subjects[i].company_info.rea_code.rea_number');
companyInfoReaCodeRegistrationDate = jResp.stringOf('subjects[i].company_info.rea_code.registration_date');
companyInfoVatNumber = jResp.stringOf('subjects[i].company_info.vat_number');
companyInfoNoReaDataFormCode = jResp.stringOf('subjects[i].company_info.no_rea_data.form_code');
companyInfoNoReaDataFormDescription = jResp.stringOf('subjects[i].company_info.no_rea_data.form_description');
personInfoFirstName = jResp.stringOf('subjects[i].person_info.first_name');
personInfoLastName = jResp.stringOf('subjects[i].person_info.last_name');
personInfoName = jResp.stringOf('subjects[i].person_info.name');
personInfoBirthDate = jResp.stringOf('subjects[i].person_info.birth_date');
personInfoBirthPlaceStreetDescription = jResp.stringOf('subjects[i].person_info.birth_place.street.description');
personInfoBirthPlaceCityCode = jResp.stringOf('subjects[i].person_info.birth_place.city.code');
personInfoBirthPlaceCityIstatCode = jResp.stringOf('subjects[i].person_info.birth_place.city.istat_code');
personInfoBirthPlaceCityDescription = jResp.stringOf('subjects[i].person_info.birth_place.city.description');
personInfoBirthPlaceProvinceCode = jResp.stringOf('subjects[i].person_info.birth_place.province.code');
personInfoBirthPlaceProvinceDescription = jResp.stringOf('subjects[i].person_info.birth_place.province.description');
personInfoBirthPlacePostalCode = jResp.stringOf('subjects[i].person_info.birth_place.postal_code');
personInfoBirthPlaceCountryCode = jResp.stringOf('subjects[i].person_info.birth_place.country.code');
personInfoBirthPlaceCountryDescription = jResp.stringOf('subjects[i].person_info.birth_place.country.description');
i++;
}
}