eSIM Exchange Business Integration API Specification v1.2

Code Query

python
1import requests
2import json
3import hashlib
4
5# URL for the request
6url = "https://api.iroamly.shop/openapi/codeQuery"
7
8# Provided AuthKey and AuthSecret, remember to replace them with real values
9auth_key = "YOUR_AUTH_KEY_HERE"
10auth_secret = "YOUR_AUTH_SECRET_HERE" 
11
12
13# Calculating Certification
14combined = auth_key + auth_secret
15certification = hashlib.sha256(combined.encode()).hexdigest()
16
17# Header parameters for the request
18headers = {
19    "Content-Type": "application/json",
20    "AuthKey": auth_key,
21    "Certification": certification
22}
23
24# Example data for the request body
25data = {
26    "orderId":"xxx-xxx-dh239jdu28"
27}
28
29# Sending POST request
30response = requests.post(url, headers=headers, data=json.dumps(data))
31
32# Printing the response content
33print(response.text)
34
35# Example of response
36{
37 "code":1,
38 "data":
39    [
40     {"productCode":"m8hed7h2fed2398dsnh","redeemCode":"nDb4TDCn6vMhbQv","status":0,"expire_at":"2024-07-04"},
41     {"productCode":"m8hed7h2fed2398dsnh","redeemCode":"oA7AWAmo76BwoGj","status":0,"expire_at":"2024-07-04"},
42     {"productCode":"cn88beg9edjdfj2sj0a","redeemCode":"XRdDeSxBVNbvCpU","status":0,"expire_at":"2024-07-04"}
43    ],
44 "msg":"success"
45}