الانتقال إلى المحتوى
iRoamly Shop

الاستعلام عن رمز الاسترداد (Python)

طلب Python كامل لـ الاستعلام عن رمز الاسترداد، بما في ذلك ترويستا AuthKey وCertification. استبدل قيمتي AuthKey وAuthSecret النائبتين بالقيم الموجودة في صفحة مفتاح API.

مرجع التعليمات البرمجية

الاستعلام عن رمز الاسترداد (Python)

python
import requests
import json
import hashlib

# URL for the request
url = "https://api.iroamly.shop/openapi/codeQuery"

# 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 = {
    "orderId":"xxx-xxx-dh239jdu28"
}

# 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,
 "data":
    [
     {"productCode":"m8hed7h2fed2398dsnh","redeemCode":"nDb4TDCn6vMhbQv","status":0,"expire_at":"2024-07-04"},
     {"productCode":"m8hed7h2fed2398dsnh","redeemCode":"oA7AWAmo76BwoGj","status":0,"expire_at":"2024-07-04"},
     {"productCode":"cn88beg9edjdfj2sj0a","redeemCode":"XRdDeSxBVNbvCpU","status":0,"expire_at":"2024-07-04"}
    ],
 "msg":"success"
}
نقاط نهاية API

الاستعلام عن رمز الاسترداد

عنوان URL للطلب:https://api.iroamly.shop/openapi/codeQuery
طريقة الطلب:POST

معلمات الطلب:

المعلمةالوصفالنوع
orderIdرقم الطلبString
مثال على المعلمات
{
  "orderId": "xxx-xxx-dh239jdu28",
}
مثال على الاستجابة
{
  "code": 1,
  "msg": "success",
  "data": [
    {
      "productCode": "m8hed7h2fed",
      "redeemCode": "3cd2m3f23f3f3",
      "expire_at": "2024-06-30", // Expiry date
      "plan": "United States-eSIM-10GB-10 Days-Total",
      "status": 0
    },
    {
      "productCode": "v2jf28dj2w",
      "redeemCode": "d923j29ef2323",
      "expire_at": "2024-06-30",
      "plan": "Albania-10GB-15 Days-Total",
      "status": 2
    }
  ]
}
مرجع التعليمات البرمجية

مزيد من أمثلة Python