Dadata 23.6.1
dotnet add package Dadata --version 23.6.1
NuGet\Install-Package Dadata -Version 23.6.1
<PackageReference Include="Dadata" Version="23.6.1" />
paket add Dadata --version 23.6.1
#r "nuget: Dadata, 23.6.1"
// Install Dadata as a Cake Addin #addin nuget:?package=Dadata&version=23.6.1 // Install Dadata as a Cake Tool #tool nuget:?package=Dadata&version=23.6.1
Dadata API Client
Data cleansing, enrichment and suggestions via Dadata API
The official Dadata .NET library, supporting .NET Standard 2.0+
Installation
Using the .NET Core command-line interface (CLI) tools:
dotnet add package Newtonsoft.Json
dotnet add package Dadata
Using the NuGet Command Line Interface (CLI):
nuget install Newtonsoft.Json
nuget install Dadata
Using the Package Manager Console:
Install-Package Newtonsoft.Json
Install-Package Dadata
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "Dadata".
- Click on the Dadata package, select the appropriate version in the right-tab and click Install.
Usage
Import namespaces:
using Dadata;
using Dadata.Model;
Create API client instance:
var token = "Replace with Dadata API key";
var secret = "Replace with Dadata secret key";
var api = new CleanClientAsync(token, secret);
// or any of the following, depending on the API method
api = new SuggestClientAsync(token);
api = new OutwardClientAsync(token);
api = new ProfileClientAsync(token, secret);
Then call API methods as specified below.
Examples use async clients: CleanClientAsync
, SuggestClientAsync
, OutwardClientAsync
and ProfileClientAsync
. There are sync alternatives with Sync
suffixes — they exist for backward compatibility and will be removed in future releases.
Postal Address
Validate and cleanse address
var api = new CleanClientAsync(token, secret);
var address = await api.Clean<Address>("мск сухонская 11 89");
Geocode address
Same API method as "validate and cleanse":
var api = new CleanClientAsync(token, secret);
var address = await api.Clean<Address>("москва сухонская 11");
Reverse geocode address
var api = new SuggestClientAsync(token);
var response = await api.Geolocate(lat: 55.878, lon: 37.653);
var address = response.suggestions[0].data;
GeoIP city
var api = new SuggestClientAsync(token);
var response = await api.Iplocate("46.226.227.20");
var address = response.location.data;
Autocomplete (suggest) address
var api = new SuggestClientAsync(token);
var response = await api.SuggestAddress("самара метал");
var address = response.suggestions[0].data;
Show suggestions in English:
var request = new SuggestAddressRequest("samara metal") { language = "en" };
var response = await api.SuggestAddress(request);
var address = response.suggestions[0].data;
Constrain by city (Yuzhno-Sakhalinsk):
var request = new SuggestAddressRequest("ватутина")
{
locations = new[] {
new Address() { kladr_id = "6500000100000" },
}
};
var response = await api.SuggestAddress(request);
var address = response.suggestions[0].data;
Constrain by specific geo point and radius (in Vologda city):
var request = new SuggestAddressRequest("сухонская")
{
locations_geo = new[]
{
new LocationGeo() { lat=59.244634, lon=39.913355, radius_meters=200}
}
};
var response = await api.SuggestAddress(request);
var address = response.suggestions[0].data;
Boost city to top (Toliatti):
var request = new SuggestAddressRequest("авто")
{
locations_boost = new[]
{
new Address() { kladr_id = "6300000700000" },
}
};
var response = await api.SuggestAddress(request);
var address = response.suggestions[0].data;
Find address by FIAS ID
var api = new SuggestClientAsync(token);
var response = await api.FindAddress("9120b43f-2fae-4838-a144-85e43c2bfb29");
var address = response.suggestions[0].data;
Find by KLADR ID:
var response = await api.FindAddress("77000000000268400");
var address = response.suggestions[0].data;
Find postal office
Suggest postal office by address or code:
var api = new OutwardClientAsync(token);
var response = await api.Suggest<PostalUnit>("дежнева 2а");
var unit = response.suggestions[0].data;
Find postal office by code:
var response = await api.Find<PostalUnit>("127642");
var unit = response.suggestions[0].data;
Find nearest postal office:
var response = await api.Geolocate<PostalUnit>(lat: 55.878, lon: 37.653, radius_meters: 1000);
var unit = response.suggestions[0].data;
Get City ID for delivery services
var api = new OutwardClientAsync(token);
var response = await api.Find<DeliveryCity>("3100400100000");
var city = response.suggestions[0].data;
Get address strictly according to FIAS
var api = new SuggestClientAsync(token);
var response = await api.FindFias("9120b43f-2fae-4838-a144-85e43c2bfb29");
var address = response.suggestions[0].data;
Suggest country
var api = new OutwardClientAsync(token);
var response = await api.Suggest<Country>("та");
var country = response.suggestions[0].data;
Company or individual enterpreneur
Find company by INN
var api = new SuggestClientAsync(token);
var response = await api.FindParty("7707083893");
var party = response.suggestions[0].data;
Find by INN and KPP:
var request = new FindPartyRequest(query: "7707083893", kpp: "540602001");
var response = await api.FindParty(request);
var party = response.suggestions[0].data;
Suggest company
var api = new SuggestClientAsync(token);
var response = await api.SuggestParty("сбер");
var party = response.suggestions[0];
Constrain by specific regions (Saint Petersburg and Leningradskaya oblast):
var request = new SuggestPartyRequest("сбер")
{
locations = new[] {
new Address() { kladr_id = "7800000000000" },
new Address() { kladr_id = "4700000000000" },
}
};
var response = await api.SuggestParty(request);
var party = response.suggestions[0];
Constrain by active companies:
var request = new SuggestPartyRequest("сбер")
{
status = new[] { PartyStatus.ACTIVE }
};
var response = await api.SuggestParty(request);
var party = response.suggestions[0];
Constrain by individual entrepreneurs:
var request = new SuggestPartyRequest("сбер")
{
type = PartyType.INDIVIDUAL
};
var response = await api.SuggestParty(request);
var party = response.suggestions[0];
Find affiliated companies
var api = new SuggestClientAsync(token);
var response = await api.FindAffiliated("7736207543");
var party = response.suggestions[0].data;
Search only by manager INN:
var request = new FindAffiliatedRequest("773006366201")
{
scope = new[] { FindAffiliatedScope.MANAGERS }
};
var response = await api.FindAffiliated(request);
var party = response.suggestions[0].data;
Bank
Find bank by BIC, SWIFT or INN
var api = new SuggestClientAsync(token);
var response = await api.FindBank("044525225");
var bank = response.suggestions[0].data;
Find by SWIFT code:
var response = await api.FindBank("SABRRUMM");
var bank = response.suggestions[0].data;
Find by INN:
var response = await api.FindBank("7728168971");
var bank = response.suggestions[0].data;
Find by INN and KPP:
var request = new FindBankRequest(query: "7728168971", kpp: "667102002");
var response = await api.FindBank(request);
var bank = response.suggestions[0].data;
Find by registration number:
var response = await api.FindBank("1481");
var bank = response.suggestions[0].data;
Suggest bank
var api = new SuggestClientAsync(token);
var response = await api.SuggestBank("ти");
var bank = response.suggestions[0].data;
Personal name
Validate and cleanse name
var api = new CleanClientAsync(token, secret);
var fullname = await api.Clean<Fullname>("Срегей владимерович иванов");
Suggest name
var api = new SuggestClientAsync(token);
var response = await api.SuggestName("викт");
var fullname = response.suggestions[0].data;
Suggest female first name:
var request = new SuggestNameRequest("викт")
{
parts = new[] { FullnamePart.NAME },
gender = Gender.FEMALE
};
var response = await api.SuggestName(request);
var fullname = response.suggestions[0].data;
Phone
Validate and cleanse phone
var api = new CleanClientAsync(token, secret);
var phone = await api.Clean<Phone>("9168-233-454");
Passport
Validate passport
var api = new CleanClientAsync(token, secret);
var passport = await api.Clean<Passport>("4509 235857");
Suggest issued by
var api = new OutwardClientAsync(token);
var response = await api.Suggest<FmsUnit>("772 053");
var unit = response.suggestions[0].data;
Validate email
var api = new CleanClientAsync(token, secret);
var email = await api.Clean<Email>("serega@yandex/ru");
Suggest email
var api = new SuggestClientAsync(token);
var response = await api.SuggestEmail("maria@");
var email = response.suggestions[0].data;
Other datasets
Tax office
var api = new OutwardClientAsync(token);
var response = await api.Find<FnsUnit>("5257");
var unit = response.suggestions[0].data;
Metro station
var api = new OutwardClientAsync(token);
var response = await api.Suggest<MetroStation>("алек");
var station = response.suggestions[0].data;
Constrain by city (Saint Petersburg):
var request = new SuggestOutwardRequest("алек")
{
filters = new Dictionary<string, string>() { { "city", "Санкт-Петербург" } }
};
var response = await api.Suggest<MetroStation>(request);
var station = response.suggestions[0].data;
Car brand
var api = new OutwardClientAsync(token);
var response = await api.Suggest<CarBrand>("фо");
var brand = response.suggestions[0].data;
OKTMO
var api = new OutwardClientAsync(token);
var response = await api.Find<OktmoRecord>("54623425");
var record = response.suggestions[0].data;
OKVED 2
var api = new OutwardClientAsync(token);
var response = await api.Suggest<OkvedRecord>("космических");
var record = response.suggestions[0].data;
Profile API
var api = new ProfileClientAsync(token, secret);
Balance:
var response = await api.GetBalance();
var balance = response.balance;
Usage stats:
var response = await api.GetDailyStats();
var cleanCount = response.services.clean;
var suggestionsCount = response.services.suggestions;
var mergingCount = response.services.merging;
Dataset versions:
var response = await api.GetVersions();
var egrulVersion = response.suggestions.resources["ЕГРЮЛ"];
var geoVersion = response.factor.resources["Геокоординаты"];
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Make sure to add or update tests as appropriate.
Use Conventional Commits for commit messages.
Changelog
This library uses CalVer with YY.MM.MICRO schema. See changelog for details specific to each release.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
All Frameworks
- Newtonsoft.Json (>= 12.0.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Dadata:
Package | Downloads |
---|---|
CodePackage.User.Remote
Makes your life easier. |
|
Spoleto.AddressResolver.Dadata
Dadata address resolver for Spoleto.AddressReolver |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
23.6.1 | 161,597 | 7/7/2023 |
23.6.0 | 810 | 7/6/2023 |
23.5.0 | 23,413 | 5/20/2023 |
22.6.0 | 218,648 | 7/19/2022 |
21.12.0 | 98,662 | 12/24/2021 |
21.9.1 | 43,955 | 11/9/2021 |
21.9.0 | 15,663 | 9/2/2021 |
21.6.0 | 54,449 | 6/30/2021 |
21.3.0 | 74,986 | 3/9/2021 |
21.2.0 | 18,959 | 2/16/2021 |
20.10.0 | 99,539 | 10/16/2020 |
20.9.0 | 6,573 | 9/9/2020 |
20.8.1 | 25,790 | 8/14/2020 |
20.8.0 | 1,103 | 8/12/2020 |
20.7.3 | 4,057 | 7/17/2020 |
20.7.2 | 1,268 | 7/16/2020 |
20.7.1 | 1,026 | 7/16/2020 |
20.7.0 | 1,116 | 7/15/2020 |
19.11.0 | 3,755 | 11/14/2019 |
19.8.2 | 2,432 | 9/27/2019 |
19.8.1 | 1,202 | 9/10/2019 |
18.9.0 | 1,810 | 8/23/2019 |
Supports Dadata API as of June 2023.