Create Voucher via Open API Not Working "Path not found" ERROR - Omada SDN Controller Open API v1
Hi,
I have this weird issue that when I tried testing the https://use1-omada-northbound.tplinkcloud.com/doc.html#/00%20All/Voucher/createVoucherGroup
/openapi/v1/{omadacId}/sites/{siteId}/hotspot/voucher-groups
Controller Version: 5.14.32.3
It will just return this response "Not Found" and this is only affect the Voucher endpoint.
{"timestamp":1736160844088,"status":404,"error":"Not Found","path":"/openapi/v1/{omadacID}/sites/siteID/hotspot/voucher-groups"}
Permissions are all set as well.
And here's my complete PHP test code.
------------------------------------------------------------------
<?php
// Define the common variables
$server_ip = "{removed}";
$omadac_id = "{removed}";
$site_id = "{removed}";
$access_token = "AT-js2IYJDT12AVhRknqImSS6KnGNJ9UnMh";
// Construct the URL
$url = "https://{$server_ip}:8043/openapi/v1/{$omadac_id}/sites/{$site_id}/hotspot/voucher-groups";
// Initialize cURL
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Only for testing; remove for production
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Only for testing; remove for production
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
"Authorization: AccessToken={$access_token}"
]);
// Add your POST data here
$voucher_data = [
"name" => "API Generated Voucher",
"amount" => 5,
"codeLength" => 6,
"codeForm" => [0, 1],
"limitType" => 0,
"limitNum" => 1,
"durationType" => 1,
"duration" => 60,
"timingType" => 1,
"rateLimit" => [
"mode" => 0,
"rateLimitProfileId" => "",
"customRateLimit" => [
"downLimitEnable" => true,
"downLimit" => 3024,
"upLimitEnable" => true,
"upLimit" => 3024
]
],
"trafficLimitEnable" => true,
"trafficLimit" => 1024,
"trafficLimitFrequency" => 0,
"unitPrice" => 1,
"currency" => "PHP",
"applyToAllPortals" => true,
"portals" => [],
"expirationTime" => 0,
"effectiveTime" => 0,
"logout" => true,
"description" => "demo from the API",
"printComments" => ""
];
$post_data = [
"createVoucherGroupOpenApiVO" => $voucher_data
];
// Set the POST data
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
// Execute the request
$response = curl_exec($ch);
// Check for errors
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
} else {
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code === 200) {
echo "Success: " . $response;
} else {
echo "Error: HTTP Status Code {$http_code}\n";
echo "Response: " . $response;
}
}
// Close cURL session
curl_close($ch);
?>
------------------------------------------------------------------
I hope from TP-link Developer team can check this.
Thank you