सामग्री पर जाएँ
iRoamly Shop

QR कोड में कन्वर्ट करें (Python)

QR कोड में कन्वर्ट करें के लिए पूरा Python अनुरोध, AuthKey और Certification हेडर सहित। प्लेसहोल्डर AuthKey और AuthSecret को अपने API कुंजी पेज के मानों से बदलें।

कोड संदर्भ

QR कोड में कन्वर्ट करें (Python)

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 कोड में कन्वर्ट करें

(नोट: कन्वर्ज़न के बाद QR कोड निर्दिष्ट ईमेल पते पर भेजे जाते हैं। बड़े बैच को प्रोसेस होने में ज़्यादा समय लग सकता है।)

अनुरोध 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",
}
कोड संदर्भ

और Python उदाहरण