Problem with omada openapi on vouchers creation

Problem with omada openapi on vouchers creation

Problem with omada openapi on vouchers creation
Problem with omada openapi on vouchers creation
a week ago - last edited a week ago
Hardware Version: V5
Firmware Version: 5.15.20.40

Hello TPLink people, 

 

I need yout help to fix a problem. 

Here's the point : I want to automatize the creation of my voucher codes on the omada cloud controller. The problem is : when I try to hit the corresponding API route, I get an error, even if everything is well configured. 

Here are some code examples of what I'm trying to do : 

 

 

voucher_group_conf = {
  "name": "test",
  "amount": 10,
  "codeLength": 6,
  "codeForm": [0,1],
  "limitType": 1,
  "limitNum": 1,
  "durationType": 1,
  "duration": 780,
  "timingType": 0,
  "rateLimit": {
    "mode": 0,
    "rateLimitProfileId": "",
    "customRateLimit": {
      "downLimitEnable": True,
      "downLimit": 0,
      "upLimitEnable": True,
      "upLimit": 0
    }
  },
  "trafficLimitEnable": True,
  "trafficLimit": 0,
  "trafficLimitFrequency": 0,
  "unitPrice": 0,
  "currency": "",
  "applyToAllPortals": True,
  "portals": [],
  "expirationTime": 0,
  "effectiveTime": 0,
  "logout": True,
  "description": "",
  "printComments": "",
  "validityType": 0,
  "schedule": {
    "type": 0,
    "dailyStartHour": 0,
    "dailyStartMin": 0,
    "dailyEndHour": 0,
    "dailyEndMin": 0,
    "weeklyEnableDays": []
  }
}
headers_create_vouchers = {
    "Content-Type" : "application/json",
    "Authorization": "AccessToken="+accessToken
}

url_create_vouchers = "https://euw1-omada-northbound.tplinkcloud.com/openapi/v1/"+ID_OMADA+"/sites/"+IDSite+"/hotspot/voucher-groups"
response = requests.post(url_create_vouchers,json=voucher_group_conf, headers=headers_create_vouchers).json()

 

When I launch the request, I get this error : {'errorCode': -1001, 'msg': 'Parameter [duration], should from 1 to 999999999\n'}

I've followed the API documentation here : https://euw1-omada-northbound.tplinkcloud.com/doc.html#/00%20All/Voucher/createVoucherGroup

Can someone help me ? 

Thank a lot to those who will try to help me. 

Best regards, 

Karton. 

  0      
  0      
#1
Options
1 Accepted Solution
Re:Problem with omada openapi on vouchers creation-Solution
a week ago - last edited a week ago

Hi  @Karton 

 

This error message is incorrect. It should be **[unitprice]**, not **[duration]**. We will fix this issue promptly.  Thank you for bringing this to our attention.

 

To resolve your problem, simply **delete the 'unitprice' row** in the configuration.  

 

Recommended Solution
  0  
  0  
#3
Options
3 Reply
Re:Problem with omada openapi on vouchers creation-Solution
a week ago - last edited a week ago

Hi  @Karton 

 

This error message is incorrect. It should be **[unitprice]**, not **[duration]**. We will fix this issue promptly.  Thank you for bringing this to our attention.

 

To resolve your problem, simply **delete the 'unitprice' row** in the configuration.  

 

Recommended Solution
  0  
  0  
#3
Options
Re:Problem with omada openapi on vouchers creation
a week ago

  @Vincent-TP I tried and everything worked ! Thanks a lot for your help !

 

Have a nice day. 

 

Karton.  

 

 

  0  
  0  
#4
Options
Re:Problem with omada openapi on vouchers creation
a week ago

  @Karton 

 

Great to hear that the issue has been resolved! If you encounter any further problems or have additional questions, feel free to reach out. We're here to help! 😊

  0  
  0  
#5
Options