Complete Device Registration
Completing the Mobile device registration is done through CompleteRegisterDevice API.
Invoke the CompleteRegisterDevice API with OTP, OTP_TOKEN, PublicKey, DeviceInfo details
On invoking the CompleteRegisterDevice API,
the mobile device is successfully registrated in ledger
the API returns a success status with a KeyId to the Mobile device App
Once the registration is done, all other APIs are signed using the private key stored in the mobile device.
Method: POST
{{URL}}/jsonrpc
Example
Payload Parameters
Parameter | Description |
---|---|
method Mandatory | String API method that is being called to complete device registration through key service Constant value – "KeyService.CompleteRegisterDevice" |
Id Mandatory | String Unique ID of API request Sample value – "1" |
params Mandatory | Object |
api Mandatory | Object |
signature Mandatory | String Signature for request validation Sample value – "signature" |
keyId Mandatory | String API key used for request authentication Sample value – "ApplicationKeyId" |
credential Mandatory | String API credential provided by NetXD Sample value – "Credential" |
payload Mandatory | Object |
UserName Mandatory | String Registered username to login the device Sample value – "admin@NetXD.com" |
OtpToken Mandatory | String Token generated during OTP generation process Sample value – "046efb3807bd4ba28a37934d66cf802d" |
Otp Mandatory | String One Time Password that is used for verification Sample value – "533842" |
PublicKey Optional | String Public key of the device that is registered Sample value – "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----" |
MFP Optional | Object |
ISOcountryCode Optional | String Country code of the country where the device is located Sample value – "IN" |
AndroidInfo Optional | Object |
AndroidVersion Optional | String Android operating system version of the device Sample value – "9" |
Brand Optional | String Brand of the device Sample value – "HONOR" |
Device Optional | String Name of the device Sample value – "HWHRY-HF" |
Id Optional | String Unique ID of the device model Sample value – "HONORHRY-AL00" |
Imei Optional | String IMEI number of the device Sample value – "866344040493624" |
Incremental Optional | String Incremental version of the device software Sample value – "275C675" |
Manufacturer Optional | String Manufacturer of the device Sample value – "HUAWEI" |
Product Optional | String Product code of the device Sample value – "HRY-AL00" |
Area Optional | String Area name where the device is located Sample value – "Perungudi" |
Country Optional | String Country name where the device is located Sample value – "India" |
Latitude Optional | String Geographical latitude of the location where the device is located Sample value – "12.9703498" |
Locality Optional | String Locality or city where the device is located Sample value – "Chennai" |
LocatedAt Optional | String Full address of the location where the device is registered Sample value – "8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India" |
Longitude Optional | String Geographical longitude of the location where the device is located Sample value – "80.2458975" |
Model Optional | String Model of the device Sample value – "HRY-AL00" |
PostalCode Optional | String Postal code of the location where the device is registered Sample value – "600096" |
SubLocality Optional | String Sub-locality within the locality or city Sample value – "Perungudi" |
- cURL
- C#
- Go
- NodeJs
curl --location --globoff '{{URL}}/jsonrpc' \
--header 'Content-Type: application/json' \
--data-raw '{"method":"KeyService.CompleteRegisterDevice","id":"1","params":{"api":{"signature":"{{signature}}","keyId":"{{ApplicationKeyId}}","credential":"{{Credential}}"},"payload":{"UserName":"admin@NetXD.com","OtpToken":"046efb3807bd4ba28a37934d66cf802d","Otp":"533842","PublicKey":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----","MFP":{"ISOcountryCode":"IN","AndroidInfo":{"AndroidVersion":"9","Brand":"HONOR","Device":"HWHRY-HF","Id":"HONORHRY-AL00","Imei":"866344040493624","Incremental":"275C675","Manufacturer":"HUAWEI","Product":"HRY-AL00"},"Area":"Perungudi","Country":"India","Latitude":"12.9703498","Locality":"Chennai","LocatedAt":"8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India","Longitude":"80.2458975","Model":"HRY-AL00","PostalCode":"600096","SubLocality":"Perungudi"}}}}'
var options = new RestClientOptions("{{URL}}/jsonrpc")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""method"": ""KeyService.CompleteRegisterDevice"",
" + "\n" +
@" ""id"": ""1"",
" + "\n" +
@" ""params"": {
" + "\n" +
@" ""api"": {
" + "\n" +
@" ""signature"": ""{{signature}}"",
" + "\n" +
@" ""keyId"": ""{{ApplicationKeyId}}"",
" + "\n" +
@" ""credential"": ""{{Credential}}""
" + "\n" +
@" },
" + "\n" +
@" ""payload"": {
" + "\n" +
@" ""UserName"": ""admin@NetXD.com"",
" + "\n" +
@" ""OtpToken"": ""046efb3807bd4ba28a37934d66cf802d"",
" + "\n" +
@" ""Otp"": ""533842"",
" + "\n" +
@" ""PublicKey"": ""-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----"",
" + "\n" +
@" ""MFP"": {
" + "\n" +
@" ""ISOcountryCode"": ""IN"",
" + "\n" +
@" ""AndroidInfo"": {
" + "\n" +
@" ""AndroidVersion"": ""9"",
" + "\n" +
@" ""Brand"": ""HONOR"",
" + "\n" +
@" ""Device"": ""HWHRY-HF"",
" + "\n" +
@" ""Id"": ""HONORHRY-AL00"",
" + "\n" +
@" ""Imei"": ""866344040493624"",
" + "\n" +
@" ""Incremental"": ""275C675"",
" + "\n" +
@" ""Manufacturer"": ""HUAWEI"",
" + "\n" +
@" ""Product"": ""HRY-AL00""
" + "\n" +
@" },
" + "\n" +
@" ""Area"": ""Perungudi"",
" + "\n" +
@" ""Country"": ""India"",
" + "\n" +
@" ""Latitude"": ""12.9703498"",
" + "\n" +
@" ""Locality"": ""Chennai"",
" + "\n" +
@" ""LocatedAt"": ""8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India"",
" + "\n" +
@" ""Longitude"": ""80.2458975"",
" + "\n" +
@" ""Model"": ""HRY-AL00"",
" + "\n" +
@" ""PostalCode"": ""600096"",
" + "\n" +
@" ""SubLocality"": ""Perungudi""
" + "\n" +
@" }
" + "\n" +
@" }
" + "\n" +
@" }
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{URL}}/jsonrpc"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"method": "KeyService.CompleteRegisterDevice",`+"
"+`
"id": "1",`+"
"+`
"params": {`+"
"+`
"api": {`+"
"+`
"signature": "{{signature}}",`+"
"+`
"keyId": "{{ApplicationKeyId}}",`+"
"+`
"credential": "{{Credential}}"`+"
"+`
},`+"
"+`
"payload": {`+"
"+`
"UserName": "admin@NetXD.com",`+"
"+`
"OtpToken": "046efb3807bd4ba28a37934d66cf802d",`+"
"+`
"Otp": "533842",`+"
"+`
"PublicKey": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----",`+"
"+`
"MFP": {`+"
"+`
"ISOcountryCode": "IN",`+"
"+`
"AndroidInfo": {`+"
"+`
"AndroidVersion": "9",`+"
"+`
"Brand": "HONOR",`+"
"+`
"Device": "HWHRY-HF",`+"
"+`
"Id": "HONORHRY-AL00",`+"
"+`
"Imei": "866344040493624",`+"
"+`
"Incremental": "275C675",`+"
"+`
"Manufacturer": "HUAWEI",`+"
"+`
"Product": "HRY-AL00"`+"
"+`
},`+"
"+`
"Area": "Perungudi",`+"
"+`
"Country": "India",`+"
"+`
"Latitude": "12.9703498",`+"
"+`
"Locality": "Chennai",`+"
"+`
"LocatedAt": "8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India",`+"
"+`
"Longitude": "80.2458975",`+"
"+`
"Model": "HRY-AL00",`+"
"+`
"PostalCode": "600096",`+"
"+`
"SubLocality": "Perungudi"`+"
"+`
}`+"
"+`
}`+"
"+`
}`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{URL}}',
'path': '/jsonrpc',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"method": "KeyService.CompleteRegisterDevice",
"id": "1",
"params": {
"api": {
"signature": "{{signature}}",
"keyId": "{{ApplicationKeyId}}",
"credential": "{{Credential}}"
},
"payload": {
"UserName": "admin@NetXD.com",
"OtpToken": "046efb3807bd4ba28a37934d66cf802d",
"Otp": "533842",
"PublicKey": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----",
"MFP": {
"ISOcountryCode": "IN",
"AndroidInfo": {
"AndroidVersion": "9",
"Brand": "HONOR",
"Device": "HWHRY-HF",
"Id": "HONORHRY-AL00",
"Imei": "866344040493624",
"Incremental": "275C675",
"Manufacturer": "HUAWEI",
"Product": "HRY-AL00"
},
"Area": "Perungudi",
"Country": "India",
"Latitude": "12.9703498",
"Locality": "Chennai",
"LocatedAt": "8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India",
"Longitude": "80.2458975",
"Model": "HRY-AL00",
"PostalCode": "600096",
"SubLocality": "Perungudi"
}
}
}
});
req.write(postData);
req.end();
Body
{
"method": "KeyService.CompleteRegisterDevice",
"id": "1",
"params": {
"api": {
"signature": "{{signature}}",
"keyId": "{{ApplicationKeyId}}",
"credential": "{{Credential}}"
},
"payload": {
"UserName": "admin@NetXD.com",
"OtpToken": "046efb3807bd4ba28a37934d66cf802d",
"Otp": "533842",
"PublicKey": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESpbiJQYGSqM69yHXMJmjWH5rmY2v\nchq8bxm5hZ6/lt+ZstgVm0HiqjU25wEtGcbIVLVJoQHilV6ikoIoqjj9Ow==\n-----END PUBLIC KEY-----",
"MFP": {
"ISOcountryCode": "IN",
"AndroidInfo": {
"AndroidVersion": "9",
"Brand": "HONOR",
"Device": "HWHRY-HF",
"Id": "HONORHRY-AL00",
"Imei": "866344040493624",
"Incremental": "275C675",
"Manufacturer": "HUAWEI",
"Product": "HRY-AL00"
},
"Area": "Perungudi",
"Country": "India",
"Latitude": "12.9703498",
"Locality": "Chennai",
"LocatedAt": "8/60, Sai Ayush Puja Avenue, Thiruvengadam Nagar, Perungudi, Chennai, Tamil Nadu 600096, India",
"Longitude": "80.2458975",
"Model": "HRY-AL00",
"PostalCode": "600096",
"SubLocality": "Perungudi"
}
}
}
}
Response: 200
Response Parameters
Parameter | Description |
---|---|
id | String Response ID echoed from the request ID Sample value: "1" |
result | Object |
Status | String Status of completing the device registration process Sample value: SUCCESS |
KeyId | String Unique key ID of the device registration process Sample value: 56978 |
{
"id": "1",
"result": {
"Status": "SUCCESS",
"KeyId": "{{ApplicationKeyId}}"
}
}