A robust and strictly-typed Java 11+ client library for the NAZK API (ЄДИНИЙ ДЕРЖАВНИЙ РЕЄСТР ДЕКЛАРАЦІЙ).
- Strict Typing: Uses Jackson for robust parsing, mapped precisely to the structure of API steps.
- Resilient: Wraps Java 11's
HttpClientwith Resilience4j to automatically retry transient errors (502, 503, 504) with exponential backoff. - Fluent API: Easily construct complex queries using the Lombok-powered Builder pattern for
DocumentFilter. - Pagination: Provides a seamless
DocumentIteratorthat auto-fetches subsequent pages for large document lists.
- Java 11 or higher
- Maven
Clone the repository and install it locally via Maven:
git clone https://github.com/AlexMelanFromRingo/nazk-api-java.git
cd nazk-api-java
mvn clean installNazkClient client = new NazkClient();
CountryResponse countries = client.getCountries();
countries.getData().forEach(country -> {
System.out.println(country.getName());
});Use the DocumentFilter builder to specify your search criteria.
NazkClient client = new NazkClient();
DocumentFilter filter = DocumentFilter.builder()
.query("Шевченко")
.declarationYear(2023)
.build();
DocumentListResponse list = client.getDocuments(filter);
list.getData().forEach(doc -> {
System.out.println("Document ID: " + doc.getId());
});If you want to seamlessly iterate over all pages without manual fetching:
NazkClient client = new NazkClient();
DocumentFilter filter = DocumentFilter.builder().query("Шевченко").build();
DocumentIterator iterator = new DocumentIterator(client, filter);
while (iterator.hasNext()) {
DocumentListItem doc = iterator.next();
System.out.println("Document ID: " + doc.getId());
}Once you have a document ID, you can fetch its full details (Steps 0-17).
NazkClient client = new NazkClient();
DocumentResponse document = client.getDocument("some-document-id");
// Access specific steps
System.out.println(document.getData().getStep0().getData());
System.out.println(document.getData().getStep2().getData());Tests are designed to be entirely dynamic and anonymized. They do not rely on hardcoded document IDs. Run the tests with:
mvn testMIT License