Isomorphic JS client for Nordnet nExt API. Client can be used both on the client and server side. Client should be used for making HTTP requests towards nExt API. See nExt API documentation for a list of possible requests.
npm install --save nordnet-next-api
Library can be used on the client and server side.
import api from 'nordnet-next-api';
api
.get('https://api.test.nordnet.se/next/2')
.then(response => console.log(response));
var api = require('nordnet-next-api');
var express = require('express');
var app = express();
app.get('/', function (req, res) {
api.get('https://api.test.nordnet.se/next/2')
.then(function(response) {
res.send(response);
})
});
Authentication is required to be able to use nExt API. Authorization
header can be used to pass session token when communicating to the API.
See nExt API documentation for more details on how to get test account and authenticate against nExt API.
import api from 'nordnet-next-api';
api.get('https://api.test.nordnet.se/next/2/accounts/{accno}', { accno: 123456789 })
.then(response => console.log(response));
import api from 'nordnet-next-api';
api.setConfig({root:'https://api.test.nordnet.se/next/2'});
api.get('/accounts/{accno}', { accno: 123456789 })
.then(response => console.log(response));
import api from 'nordnet-next-api';
api.get('https://api.test.nordnet.se/next/2/accounts/{accno}', { accno: 123456789 })
.then(response => console.log(response));
import api from 'nordnet-next-api';
api.get('https://api.test.nordnet.se/next/2/user/{key}', { key: 'foo', value: { bar: 'bar' }})
.then(response => console.log(response));
import api from 'nordnet-next-api';
api.get('https://api.test.nordnet.se/next/2/markets/{market_id}', { market_id: 80 }, { 'Accept-Language': 'sv' })
.then(response => console.log(response));
See tests under src/__tests__
for more examples.
nordnet-next-api is distributed with a two simple example projects.
Before proceeding, install dependencies and build the project:
npm install
npm run build
Run the client side example:
cd examples/client
npm install
npm start
Run the server side example:
cd examples/server
npm install
npm start
This Open Source project released by Nordnet is licensed under the MIT license.