Open source Java client library for use with the NVDB REST API v3.
Support or feedback: Issue on this repo or on Gitter
Base URL for the API is https://www.vegvesen.no/nvdb/api/v3
This artifact will be published to jCenter upon releases: http://jcenter.bintray.com/ See 'set me up' on bintray for the latest version number.
dependencies {
compile "no.vegvesen.nvdb:nvdb-read-api-v3-client:$version"
}
repositories {
maven {
url "https://dl.bintray.com/nvdb-vegdata/vegdata"
}
}
<dependencies>
<dependency>
<groupId>no.vegvesen.nvdb</groupId>
<artifactId>nvdb-read-api-v3-client</artifactId>
<version>$version</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-nvdb-vegdata-vegdata</id>
<name>bintray</name>
<url>https://dl.bintray.com/nvdb-vegdata/vegdata</url>
</repository>
</repositories>
Using the client is very simple. All it takes is a couple of lines of code.
This is a completely open API, but some featuretypes are restricted and need authentication and authorization. We strongly encourage using the X-Client-Name header because it helps us gather statistics which we use to improve the API.
To start using the library simply instantiate the factory. It takes three arguments:
- Base URL for the API
- Value for request header X-Client-Name
// First, create factory
ClientFactory factory = new ClientFactory("https://www.vegvesen.no/nvdb/api/v3", "nvdb-read-api-v3-client");
// Then, create your client. Typically, there's one per root endpoint
RoadObjectClient client = factory.createRoadObjectClient();
// Example single object download
RoadObject ro = client.getRoadObject(534, 1);
// Remember to close your factory when you're done using it
factory.close();
The repo contains the Gradle wrapper. The client is built running:
// Simple compilation
./gradlew build
// Publish to your Maven local
./gradlew publishToMavenLocal