An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

### CI Status
[![Build Status](https://travis-ci.org/Biacode/joverheid.svg?branch=master)](https://travis-ci.org/Biacode/joverheid)
[![SonarCube](https://getstreaming.files.wordpress.com/2012/10/sonar.png)](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)