https://github.com/kuliginstepan/dadata-client
Dadata Suggestions API client for Spring (Java)
https://github.com/kuliginstepan/dadata-client
dadata-api dadata-client java spring
Last synced: about 1 month ago
JSON representation
Dadata Suggestions API client for Spring (Java)
- Host: GitHub
- URL: https://github.com/kuliginstepan/dadata-client
- Owner: KuliginStepan
- License: apache-2.0
- Created: 2019-04-28T22:06:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T16:36:00.000Z (almost 3 years ago)
- Last Synced: 2025-04-24T14:01:56.590Z (10 months ago)
- Topics: dadata-api, dadata-client, java, spring
- Language: Java
- Homepage:
- Size: 283 KB
- Stars: 20
- Watchers: 3
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](https://www.codacy.com/app/KuliginStepan/dadata-client?utm_source=github.com&utm_medium=referral&utm_content=KuliginStepan/dadata-client&utm_campaign=Badge_Grade)
[](https://codecov.io/gh/KuliginStepan/dadata-client)
# dadata-client
Dadata Suggestions API client for Spring (Java)
## Overview
Dadata API client based on non-blocking HTTP client of Spring WebClient. Supports all methods of Suggestion API
## [Release notes](ReleaseNotes.md)
## Add a dependency
Gradle:
dependencies {
implementation 'com.github.kuliginstepan:dadata-client:Tag'
}
Maven:
com.github.kuliginstepan
dadata-client
Tag
## Configuration
Dadata client provides `DadataClientAutoConfiguration` which configures `DadataClient` bean for you.
### Primary settings
It's required to add property `dadata.client.token` with your Dadata API Token.
You may add property `dadata.client.timeout` to configure dadata client request timeout, defaults to 5 seconds.
Via `dadata.client.baseUrl` you can change Dadata base url, defaults to https://suggestions.dadata.ru/suggestions/api/4_1/rs
`dadata.client.maxInMemorySize` defines max buffer size for response, defaults to 512K. You can change it if you have memory issues.
### Proxy support and SSL verification
`dadata.client.proxy.type` - valid values are: HTTP, SOCKS4, SOCKS5, defaults to HTTP
`dadata.client.proxy.server` - proxy hostname or ip address
`dadata.client.proxy.port` - proxy port, positive number
If you have configured above options you can use authentication via username/password pair just setting system properties for them.
- for HTTP proxy you should use `http.proxyUser` and `http.proxyPassword` respectively.
- for SOCKS proxy you should use `java.net.socks.username` and `java.net.socks.password` respectively.
There is no authorization at proxy if no username defined in system environment.
`dadata.client.verifySsl` - enable/disable server SSL-certificate verification at client-side, defaults to true
## Usage
Autowire `DadataClient` in your beans and call api methods, for example:
```
@Service
public class SomeService {
@Autowired
private DadataClient client;
public Flux> getSuggestionsForAddress(String query) {
return client.suggestAddress(AddressRequestBuilder.create(query).build());
}
}
```
Request builders allow filter and rank suggestions. More examples are available in the `test` module