eSIM Exchange Business Integration API Specification v1.2

Copy code
import requests import json import hashlib # URL for the request url = "https://api.iroamly.shop/openapi/purchaseCode" # Provided AuthKey and AuthSecret, remember to replace them with real values auth_key = "YOUR_AUTH_KEY_HERE" auth_secret = "YOUR_AUTH_SECRET_HERE" # Calculating Certification combined = auth_key + auth_secret certification = hashlib.sha256(combined.encode()).hexdigest() # Header parameters for the request headers = { "Content-Type": "application/json", "AuthKey": auth_key, "Certification": certification } # Example data for the request body data = { "email": "[email protected]", "productList": [ { "productCode": "m8hed7h2fed2398dsnh", "quantity": 2 }, { "productCode": "cn88beg9edjdfj2sj0a", "quantity": 1 } ] } # Sending POST request response = requests.post(url, headers=headers, data=json.dumps(data)) # Printing the response content print(response.text) # Example of response { "code":1, "msg":"success", "orderId":"xxx-xxxx-sd9hn8df333" }