Skip to content

Commit d36bb40

Browse files
committed
Update README.md
1 parent 9ad6658 commit d36bb40

File tree

1 file changed

+68
-10
lines changed

1 file changed

+68
-10
lines changed

README.md

+68-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
hlr-lookup-api-nodejs-sdk
2-
=========================
1+
node-hlr-client
2+
===============
33
Official HLR Lookup API Node JS SDK by www.hlr-lookups.com
44

55
This SDK implements the REST API documented at https://www.hlr-lookups.com/en/api-docs
66

7-
For SDKs in different languages, see https://www.hlr-lookups.com/en/sdks
7+
For SDKs in other programming languages, see https://www.hlr-lookups.com/en/sdks
88

99
Requirements
1010
------------
@@ -21,6 +21,8 @@ npm install node-hlr-client
2121
#!/usr/bin/env node
2222

2323
var HlrLookupClient = require("node-hlr-client");
24+
var StringDecoder = require('string_decoder').StringDecoder;
25+
var decoder = new StringDecoder('utf8');
2426

2527
var client = new HlrLookupClient(
2628
'username',
@@ -36,14 +38,29 @@ var client = new HlrLookupClient(
3638
* @param storage - An optional storage assignment, see: http://www.hlr-lookups.com/en/storages
3739
* @returns {*}
3840
*
39-
* Callback example: {"success":true,"results":[{"id":"e1fdf26531e4","msisdncountrycode":"DE","msisdn":"+491788735000","statuscode":"HLRSTATUS_DELIVERED","hlrerrorcodeid":null,"subscriberstatus":"SUBSCRIBERSTATUS_CONNECTED","imsi":"262031300000000","mccmnc":"26203","mcc":"262","mnc":"03","msin":"1300000000","servingmsc":"140445","servinghlr":null,"originalnetworkname":"E-Plus","originalcountryname":"Germany","originalcountrycode":"DE","originalcountryprefix":"+49","originalnetworkprefix":"178","roamingnetworkname":"Fixed Line Operators and Other Networks","roamingcountryname":"United States","roamingcountrycode":"US","roamingcountryprefix":"+1","roamingnetworkprefix":"404455","portednetworkname":null,"portedcountryname":null,"portedcountrycode":null,"portedcountryprefix":null,"portednetworkprefix":null,"isvalid":"Yes","isroaming":"Yes","isported":"No","usercharge":"0.0100","inserttime":"2014-12-28 06:22:00.328844+08","storage":"SDK-TEST-SYNC-API","route":"IP1"}]}
41+
* Callback example: {"success":true,"results":[{"id":"e1fdf26531e4","msisdncountrycode":"DE","msisdn":"+491788735000","statuscode":"HLRSTATUS_DELIVERED","hlrerrorcodeid":null,"subscriberstatus":"SUBSCRIBERSTATUS_CONNECTED","imsi":"262031300000000","mccmnc":"26203","mcc":"262","mnc":"03","msin":"1300000000","servingmsc":"140445","servinghlr":null,"originalnetworkname":"E-Plus","originalcountryname":"Germany","originalcountrycode":"DE","originalcountryprefix":"+49","originalnetworkprefix":"178","roamingnetworkname":"Fixed Line Operators and Other Networks","roamingcountryname":"United States","roamingcountrycode":"US","roamingcountryprefix":"+1","roamingnetworkprefix":"404455","portednetworkname":null,"portedcountryname":null,"portedcountrycode":null,"portedcountryprefix":null,"portednetworkprefix":null,"isvalid":"Yes","isroaming":"Yes","isported":"No","usercharge":"0.0100","inserttime":"2014-12-28 06:22:00.328844+08","storage":"SDK-TEST-SYNC-API","route":"IP1","interface":"Sync API"}]}
4042
*/
4143
client.submitSyncLookupRequest(function(response) {
42-
console.log(response);
44+
console.log(decoder.write(response));
4345
}, '+491788735000');
4446

4547
/**
46-
* Submits asynchronous HLR Lookups containing up to 1,000 MSISDNs per request. Results are sent back asynchronously to a callback URL on your server.
48+
* Submits a synchronous number type lookup request. The HLR is queried in real time and results presented in the response body.
49+
*
50+
* @param callback - callback function(response)
51+
* @param number - An number in international format, e.g. +4989702626
52+
* @param route - An optional route assignment, see: http://www.hlr-lookups.com/en/routing-options
53+
* @param storage - An optional storage assignment, see: http://www.hlr-lookups.com/en/storages
54+
* @returns {*}
55+
*
56+
* Callback example: {"success":true,"results":[{"id":"2ed0788379c6","number":"+4989702626","numbertype":"LANDLINE","state":"COMPLETED","isvalid":"Yes","invalidreason":null,"ispossiblyported":"No","isvanitynumber":"No","qualifiesforhlrlookup":"No","originalcarrier":null,"mccmnc":null,"mcc":null,"mnc":null,"countrycode":"DE","regions":["Munich"],"timezones":["Europe\/Berlin"],"infotext":"This is a landline number.","usercharge":"0.0050","inserttime":"2015-12-04 10:36:41.866283+00","storage":"SYNC-API-NT-2015-12","route":"LC1","interface":"Sync API"}]}
57+
*/
58+
client.submitSyncNumberTypeLookupRequest(function(response) {
59+
console.log(decoder.write(response));
60+
}, '+4989702626');
61+
62+
/**
63+
* Submits asynchronous HLR Lookups containing up to 1,000 MSISDNs per request. Results are sent back asynchronously to a callback URL on your server. Use \VmgLtd\HlrCallbackHandler to capture them.
4764
*
4865
* @param callback - callback function(response)
4966
* @param msisdns - A list of MSISDNs in international format, e.g. +491788735000
@@ -54,9 +71,24 @@ client.submitSyncLookupRequest(function(response) {
5471
* Callback example: {"success":true,"messages":[],"results":{"acceptedMsisdns":[{"id":"e489a092eba7","msisdn":"+491788735000"},{"id":"23ad48bf0c26","msisdn":"+491788735001"}],"rejectedMsisdns":[],"acceptedMsisdnCount":2,"rejectedMsisdnCount":0,"totalCount":2,"charge":0.02,"storage":"SDK-TEST-ASYNC-API","route":"IP4"}}
5572
*/
5673
client.submitAsyncLookupRequest(function(response) {
57-
console.log(response);
74+
console.log(decoder.write(response));
5875
}, ['+491788735000', '+491788735001']);
5976

77+
/**
78+
* Submits asynchronous number type lookups containing up to 1,000 numbers per request. Results are sent back asynchronously to a callback URL on your server.
79+
*
80+
* @param callback - callback function(response)
81+
* @param numbers - A list of numbers in international format, e.g. +4989702626,+491788735000
82+
* @param route - An optional route assignment, see: http://www.hlr-lookups.com/en/routing-options
83+
* @param storage - An optional storage assignment, see: http://www.hlr-lookups.com/en/storages
84+
* @returns {*}
85+
*
86+
* Callback example: {"success":true,"messages":[],"results":{"acceptedNumbers":[{"id":"4f0820c76fb7","number":"+4989702626"},{"id":"9b9a7dab11a4","number":"+491788735000"}],"rejectedNumbers":[],"acceptedNumberCount":2,"rejectedNumberCount":0,"totalCount":2,"charge":0.01,"storage":"ASYNC-API-NT-2015-12","route":"LC1"}}
87+
*/
88+
client.submitAsyncNumberTypeLookupRequest(function(response) {
89+
console.log(decoder.write(response));
90+
}, ['+4989702626', '+491788735000']);
91+
6092
/**
6193
* Sets the callback URL for asynchronous lookups. Read more about the concept of asynchronous HLR lookups @ http://www.hlr-lookups.com/en/asynchronous-hlr-lookup-api
6294
*
@@ -67,7 +99,20 @@ client.submitAsyncLookupRequest(function(response) {
6799
* Callback example: {"success":true,"messages":[],"results":{"url":"http:\/\/user:pass@www.your-server.com\/path\/file"}}
68100
*/
69101
client.setAsyncCallbackUrl(function(response) {
70-
console.log(response);
102+
console.log(decoder.write(response));
103+
}, 'http://user:pass@www.your-server.com/path/file');
104+
105+
/**
106+
* Sets the callback URL for asynchronous number type lookups.
107+
*
108+
* @param callback - callback function(response)
109+
* @param url - callback url on your server
110+
* @returns {*}
111+
*
112+
* Callback example: {"success":true,"messages":[],"results":{"url":"http:\/\/user:pass@www.your-server.com\/path\/file"}}
113+
*/
114+
client.setNtAsyncCallbackUrl(function(response) {
115+
console.log(decoder.write(response));
71116
}, 'http://user:pass@www.your-server.com/path/file');
72117

73118
/**
@@ -79,8 +124,21 @@ client.setAsyncCallbackUrl(function(response) {
79124
* Callback example: {"success":true,"messages":[],"results":{"balance":"5878.24600"}}
80125
*/
81126
client.getBalance(function(response) {
82-
console.log(response);
127+
console.log(decoder.write(response));
83128
});
129+
130+
/**
131+
* Performs a system health check and returns a sanity report.
132+
*
133+
* @param callback - callback function(response)
134+
* @returns {*}
135+
*
136+
* Return example: { "success":true, "results":{ "system":{ "state":"up" }, "routes":{ "states":{ "IP1":"up", "ST2":"up", "SV3":"up", "IP4":"up", "XT5":"up", "XT6":"up", "NT7":"up", "LC1":"up" } }, "account":{ "lookupsPermitted":true, "balance":"295.23000" } } }
137+
*/
138+
client.doHealthCheck(function(response) {
139+
console.log(decoder.write(response));
140+
});
141+
84142
```
85143

86144
**Usage Callback Handler**
@@ -126,7 +184,7 @@ The code contains annotations and you can find usage examples as tests in `tests
126184
* `tests/test-client.js`
127185
* `tests/test-callback.js`
128186

129-
Please refer to https://www.hlr-lookups.com/en/sdk-node-js for further documentation or send us an email to service@hlr-lookups.com.
187+
Please refer to https://www.hlr-lookups.com/en/sdks/nodejs for further documentation or send us an email to service@hlr-lookups.com.
130188

131189
Support and Feedback
132190
--------------------

0 commit comments

Comments
 (0)