DHRU integration
IMEILookup also exposes a DHRU-style interface for panels and clients that speak that protocol. It is separate from the REST API: different endpoint, different authentication, different request body and different errors. Do not mix the two.
POST https://api.imeilookup.com/dhru/api/index.php
The four basic actions below were tested with a real account.
Request format
Send an HTTPS POST with Content-Type: application/x-www-form-urlencoded
and these fields:
| Field | Value |
|---|---|
username | Your account username |
apiaccesskey | Your API key |
requestformat | JSON |
action | One of accountinfo, imeiservicelist, placeimeiorder, getimeiorder |
parameters | Order actions only: an XML string, URL-encoded with the rest |
Authentication is not the REST access-key header, and the body is not
a JSON object.
Account balance
Returned as credit and creditraw.
curl --request POST 'https://api.imeilookup.com/dhru/api/index.php' \
--data-urlencode 'username=YOUR_USERNAME' \
--data-urlencode 'apiaccesskey=YOUR_API_KEY' \
--data-urlencode 'requestformat=JSON' \
--data-urlencode 'action=accountinfo'
{
"apiversion": "5.2",
"SUCCESS": [
{
"message": "You account info",
"AccoutInfo": {
"mail": "you@example.com",
"currency": "USD",
"creditraw": "10.00",
"credit": "10.00"
}
}
]
}
The response key is spelled AccoutInfo. That is the wire format, so keep the
spelling in your parser. The account currency is in currency.
List services
curl --request POST 'https://api.imeilookup.com/dhru/api/index.php' \
--data-urlencode 'username=YOUR_USERNAME' \
--data-urlencode 'apiaccesskey=YOUR_API_KEY' \
--data-urlencode 'requestformat=JSON' \
--data-urlencode 'action=imeiservicelist'
The result is grouped. Each group under LIST has a SERVICES object keyed by
service ID, and each service has a SERVICEID, SERVICENAME, TIME, CREDIT
and INFO field. INFO is sample output, not a description.
Use the catalog your own account returns. It differs between accounts, so do not hard-code service IDs from this page.
Place an order
curl --request POST 'https://api.imeilookup.com/dhru/api/index.php' \
--data-urlencode 'username=YOUR_USERNAME' \
--data-urlencode 'apiaccesskey=YOUR_API_KEY' \
--data-urlencode 'requestformat=JSON' \
--data-urlencode 'action=placeimeiorder' \
--data-urlencode 'parameters=<PARAMETERS><ID>SERVICE_ID</ID><IMEI>YOUR_IDENTIFIER</IMEI></PARAMETERS>'
Submitting a valid request creates an order and can use credit.
{
"apiversion": "5.2",
"SUCCESS": [{ "MESSAGE": "Order received", "REFERENCEID": "32344394" }]
}
REFERENCEID is the order reference. It means the order was received, not that
the result is ready. In both tested submissions it came back in under a second.
Escape the identifier when you build the XML.
Get an order
curl --request POST 'https://api.imeilookup.com/dhru/api/index.php' \
--data-urlencode 'username=YOUR_USERNAME' \
--data-urlencode 'apiaccesskey=YOUR_API_KEY' \
--data-urlencode 'requestformat=JSON' \
--data-urlencode 'action=getimeiorder' \
--data-urlencode 'parameters=<PARAMETERS><ID>REFERENCEID</ID></PARAMETERS>'
{
"SUCCESS": [
{
"CODE": "IMEI: 357619537445062\nManufacturer: Apple Inc\nModel Code: A2403\nModel Name: iPhone 12",
"STATUS": 4
}
],
"apiversion": "5.2"
}
STATUS: 4 means the order finished successfully. CODE is multi-line text,
not the REST result object. Render it as escaped text, never as HTML.
Errors
Errors come back with HTTP 200. Always look for an ERROR array in the
body; the HTTP status says nothing about success.
{
"apiversion": "5.2",
"ERROR": [
{ "MESSAGE": "Invalid API key.", "FULL_DESCRIPTION": "Invalid API key provided." }
]
}
MESSAGE | When it was seen |
|---|---|
Invalid API key. | The key is unknown |
Invalid API Key. | The key was missing or badly formatted |
Invalid user. | The username is wrong |
Invalid username. | The username was missing |
Invalid action. | The action is not supported |
Missing some parameters. | A required parameter is missing, or the parameters encoding was rejected |
Order not found. | No order exists for that reference |
This error format is DHRU's own. It does not follow the REST error format.