轉換為 QR Code(Python)
轉換為 QR Code 的完整 Python 請求,包含 AuthKey 與 Certification 標頭。請將預留的 AuthKey 與 AuthSecret 替換為您 API 金鑰頁面上的值。
程式碼參考
轉換為 QR Code(Python)
import requests
import json
import hashlib
# URL for the request
url = "https://api.iroamly.shop/openapi/redeemQRcode"
# 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": "2m827n32d@gmail.com",
"codeList": [
{
"redeemCode": "nDb4TDCn6vMhbQv",
},
{
"redeemCode": "XRdDeSxBVNbvCpU",
}
]
}
# 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"}
API 端點
轉換為 QR Code
(注意:轉換完成後,QR Code 會寄送至指定的電子郵件。批次越大,處理時間可能越長。)
請求 URL:
https://api.iroamly.shop/openapi/redeemQRcode請求方法:
POST請求參數:
參數說明類型
email電子郵件String
codeList兌換碼集合Object[]
productList 欄位:
欄位說明類型
redeemCode兌換碼String
{
"email": "2m827n32d@gmail.com",
"codeList": [
{
"redeemCode": "m8hed7h2fed",
},
{
"redeemCode": "cn88beg9edj",
}
]
}{
"code": 1,
"msg": "success",
}程式碼參考