Dependencies
Add the following dependencies to yourpom.xml:
pom.xml
- Apache Commons Codec provides the
DigestUtils.md5()andHex.encodeHexString()utilities used to compute the signature. - Jodd HTTP is a lightweight HTTP client used to send form-encoded
POSTrequests.
Computing the signature
Every request to the MIOeSIM API requires asign parameter. Compute it with the createSign method below.
Sign.java
- Removes
signfrom the parameter map so it is never included in the input string. - Formats each remaining parameter as
key=valueand sorts them alphabetically. - Concatenates the sorted strings, appends your secret key, and returns the lowercase MD5 hex digest.
Logging in
CallPOST /api_order/login to exchange your phone number and password for a session token. The login request itself must include a valid sign.
Login.java
data field:
Making authenticated API calls
After login, include bothtoken and sign on every request. The example below calls GET /api_esim/getSkus to retrieve available eSIM packages.
GetSkus.java
token first, compute sign from that map, then add sign to the map before sending the request.
Tokens are valid for 2 hours. Store the token and its issue time, then re-authenticate before the token expires rather than calling login on every request. A refresh interval of 90 minutes works well in practice.
