Methods
(static) getAddresses(options, queryopt, callback)
Returns a list of addresses, it is possible to filter on postcode (P6-formatted) and number. Instance of GET /addresses.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for performing the API call and influencing the callback. Properties
|
|||||||||||||||||||||||||
query |
Object |
<optional> |
Containing the query for calling the API. Must be an empty object if no filtering is needed. Properties
|
||||||||||||||||||||||||
callback |
function | A callback which is called when the API-request is finished. Properties
|
- Since:
- 1.2.0
- Source:
Example
const postcodeApi = require('postcode-nl');
let options = {
apiKey : 'abcdefghijklmnopQRSTUVWXYZ123',
returnRateLimit : true
};
let query = {
postcode: '1234AB'
};
postcodeApi.getAddresses(options, query, (error, result, rateLimit) => {
if (!error) {
console.log(result); // Shows the output of the API directy in the console
console.log(rateLimit); // Shows the rateLimit information in the console
}
});
(static) getAddressesByPostcodeAndNumber(options, query, callback)
Returns a list of addresses filtered on postcode (P6-formatted) and number. The difference with getAddresses
is that filtering is required, otherwise an error is thrown. Instance of GET /addresses.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for performing the API call and influencing the callback. Properties
|
||||||||||||||||
query |
Object | Containing the query for calling the API. Properties
|
||||||||||||||||
callback |
function | A callback which is called when the API-request is finished. Properties
|
- Since:
- 1.2.0
- Source:
Example
const postcodeApi = require('postcode-nl');
let options = {
apiKey : 'abcdefghijklmnopQRSTUVWXYZ123',
returnRateLimit : true
};
let query = {
postcode: '1234AB',
number: 10
};
postcodeApi.getAddressesByPostcodeAndNumber(options, query, (error, result, rateLimit) => {
if (!error) {
console.log(result); // Shows the output of the API directy in the console
console.log(rateLimit); // Shows the rateLimit information in the console
}
});
(static) getPostcodes(options, queryopt, callback)
Returns a list of postcodes (P6), optionally filtered on postcode area. Instance of GET /postcodes.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for performing the API call and influencing the callback. Properties
|
|||||||||||||||||||||
query |
Object |
<optional> |
Containing the query for calling the API. Must be an empty object if no filtering is needed. Properties
|
||||||||||||||||||||
callback |
function | A callback which is called when the API-request is finished. Properties
|
- Since:
- 1.2.0
- Source:
Example
const postcodeApi = require('postcode-nl');
let options = {
apiKey : 'abcdefghijklmnopQRSTUVWXYZ123',
returnRateLimit : true
};
let postcodeArea = '1234';
postcodeApi.getPostcodeArea(options, id, (error, result, rateLimit) => {
if (!error) {
console.log(result); // Shows the output of the API directy in the console
console.log(rateLimit); // Shows the rateLimit information in the console
}
});
(static) getSingleAddress(options, id, callback)
To search for an address based on the BAG identifier of the object. Instance of GET /addresses.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for performing the API call and influencing the callback. Properties
|
||||||||||||||||
id |
String | The BAG identifier of the object. |
||||||||||||||||
callback |
function | A callback which is called when the API-request is finished. Properties
|
- Since:
- 1.1.0
- Source:
Example
const postcodeApi = require('postcode-nl');
let options = {
apiKey : 'abcdefghijklmnopQRSTUVWXYZ123',
returnRateLimit : true
};
let id = '0268200000075156';
postcodeApi.getSingleAddress(options, id, (error, result, rateLimit) => {
if (!error) {
console.log(result); // Shows the output of the API directy in the console
console.log(rateLimit); // Shows the rateLimit information in the console
}
});
(static) getSinglePostcode(options, postcode, callback)
Returns the details of one P6 postcode. Instance of GET /postcodes.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for performing the API call and influencing the callback. Properties
|
||||||||||||||||
postcode |
String | The postcode to query, formatted in P6. |
||||||||||||||||
callback |
function | A callback which is called when the API-request is finished. Properties
|
- Since:
- 1.0.0
- Source:
Example
const postcodeApi = require('postcode-nl');
let options = {
apiKey : 'abcdefghijklmnopQRSTUVWXYZ123'
};
let postcode = '1234AB';
postcodeApi.getSinglePostcode(options, postcode, (error, result) => {
if (!error) {
console.log(result); // Shows the json-output of the API directy in the console
}
});