Code Monkey home page Code Monkey logo

ns-api's Introduction

Build Status Coverage Status

NS API

An API for talking to the NS (Dutch railways) API interface written in Java. The NS is using a mix between Dutch and English terms in their API. This reflects back to the Java implementation. The preferred language is English but some Dutch terms show up. Javadoc is English. When Dutch terms are used a translation is provided

Usage

To use the NS api you need to register an account with the NS. You can apply for an account at NS API.

You will receive a username and password. To use the Java api, you initialize the NsApi object:

NsApi nsApi = new NsApi(username, password);

Next step is to create a request, eg a 'actuele vertrektijden' request to get the current departures:

ApiRequest<ActueleVertrekTijden> request = RequestBuilder.getActueleVertrektijden(stationName)

To do the actual request, you call getApiResponse with your request:

ActueleVertrekTijden vertrekTijden = nsApi.getApiResponse(request); 

A new immutable object ActueleVertrekTijden is created containing the result of the API call.

All classes are immutable and thread safe.

Maven

Version 1.0 of this api is available in the central maven repository:

<dependency>
  <groupId>nl.pvanassen</groupId>
  <artifactId>ns-api</artifactId>
  <version>1.1.0</version>
</dependency>

Code borrowing

For parsing the XML I made use of the code found in this article: http://blog.another-d-mention.ro/programming/the-simplest-way-to-parse-xml-in-java/

License

The code is licensed under the Apache License.

ns-api's People

Contributors

pvanassen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

ns-api's Issues

Date vs LocalDateTime

Zou je de Date attributen kunnen bijwerken naar het inmiddels meer gangbare ZonedDateTime of gewoon direct LocalDateTime?

Getting it worked on mac

Hey,

I'm a dutch student and i need to use the NS-api for a project. I am using an MacBook. but i am struggling for days. I hope someone can help me to getting it worked

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.