https://github.com/biacode/joverheid
Java implementation of Overheid.io API
https://github.com/biacode/joverheid
Last synced: over 1 year ago
JSON representation
Java implementation of Overheid.io API
- Host: GitHub
- URL: https://github.com/biacode/joverheid
- Owner: Biacode
- License: apache-2.0
- Created: 2016-10-20T08:08:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-14T14:32:48.000Z (over 5 years ago)
- Last Synced: 2025-02-01T13:28:31.872Z (over 1 year ago)
- Language: Java
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### CI Status
[](https://travis-ci.org/Biacode/joverheid)
[](https://sonarqube.com/dashboard/index/com.sfl.joverheid:joverheid)
# joverheid
Java implementation of Overheid.io API
# How to use
### Installation
First of all, you need any implementation of ```javax.ws.rs.client.Client```
For example you can use jersey client
Add the following dependency to your maven pom.xml file
```xml
org.glassfish.jersey.core
jersey-client
${jersey.client.version}
```
Then you need pass client implementation to OverheidClient as constructor param.
# Example to construct client implementation in spring framework.
In application context XML add the following XML definition
```java
```
# If you simply need to test overheid API.
Then construct jersey client as follows
```java
package my.application;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import org.biacode.joverheid.api.client.OverheidClient;
import org.biacode.joverheid.api.client.impl.OverheidClientImpl;
import org.biacode.joverheid.api.model.common.OverheidResult;
import org.biacode.joverheid.api.model.request.GetCorporationsRequest;
import org.biacode.joverheid.api.model.response.GetCorporationsResponse;
import javax.ws.rs.client.ClientBuilder;
import java.util.HashMap;
import java.util.Map;
public class MainApplication {
public static void main(String[] args) {
// construct overheid java client
final OverheidClient overheidClient = new OverheidClientImpl(
ClientBuilder.newBuilder().register(JacksonJsonProvider.class).build(),
"Your API key here"
);
// you can build filters and pass them to the request constructor as follows
final Map filters = new HashMap<>();
filters.put("size", "10");
filters.put("filters[postcode]", "3083cz");
final GetCorporationsRequest getCorporationsRequest = new GetCorporationsRequest(filters);
final OverheidResult corporations = overheidClient
.getCorporations(getCorporationsRequest);
// check if there is any error
if (corporations.hasError()) {
System.out.println(corporations.getError());
} else {
// the getResponse() will return the response models E.g. embedded and links
System.out.println(corporations.getResponse());
System.out.println(corporations.getResponse().getEmbedded());
System.out.println(corporations.getResponse().getLinks());
}
}
}
```
# Available API calls
**Get single corporation**
```
overheidClient.getCorporation(new GetCorporationRequest(12345, "subdossier nummer here"));
```
**Get corporations**
```
overheidClient.getCorporations(new GetCorporationsRequest(filters));
```
**Get dossier corporation**
```
overheidClient.getDossierCorporation(new GetDossierCorporationRequest(12345));
```
**Get suggestions**
```
overheidClient.getSuggestion(new SuggestionRequest("oudet", filters));
```
# Best practices
Make singleton of the ```OverheidClient``` so you do not need to construct the client for every API call
The official Overheid [documentation](https://overheid.io/documentatie/kvk)