Problem with omada openapi on vouchers creation
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.