Comments (23)
yes it is ok now thank you
On Tue, Nov 8, 2016 at 6:04 PM, malle-pietje [email protected]
wrote:
@tirannilakshe https://github.com/tirannilakshe A function/method to
delete vouchers can certainly be added, I will do that with the new release
of the API client which will also include the improved create_voucher()
function after your confirmation that the above modification works.For blocking/unblocking clients the block_sta() and unblock_sta()
functions should do the trick. Have you already tried that?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkb_CBH9y3qTg_qkHAkh2xiYQ9huaZYks5q8Gw9gaJpZM4JrGXd
.
from unifi-api-browser.
revoke_voucher() ok now how about disconnect and extend in guest actions
On Wed, Nov 9, 2016 at 8:05 PM, malle-pietje [email protected]
wrote:
@tiransa https://github.com/tiransa I have pushed a new version of the
API client class and the API browser tool. Could you please check whether
the new revoke_voucher() function/methods does what you wanted to achieve
with regard to voucher deletion?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkb_KAXRifgOpZdEe8Xsnl9mWAcrscnks5q8do9gaJpZM4JrGXd
.
from unifi-api-browser.
@tiransa This function should let you create hotspot operators. Could you please test and confirm back if it's working?
/**
* Create hotspot operator
* -----------------
* returns TRUE upon success
* required parameter <name> = name for the hotspot operator
* required parameter <x_password> = clear text password for the hotspot operator
* optional parameter <note> = note to attach to the hotspot operator
*/
public function create_hotspotop($name, $x_password, $note = NULL) {
if (!$this->is_loggedin) return FALSE;
$return = FALSE;
$json = array('name' => $name, 'x_password' => $x_password);
/**
* if we have received a value for note, we append it to the payload array to be submitted
*/
if (isset($note)) $json['note'] = trim($note);
$json = json_encode($json);
$content_decoded = json_decode($this->exec_curl($this->baseurl.'/api/s/'.$this->site.'/rest/hotspotop','json='.$json));
if (isset($content_decoded->meta->rc)) {
if ($content_decoded->meta->rc == 'ok') {
$return = TRUE;
}
}
return $return;
}
from unifi-api-browser.
Basically what you need to do is create the vouchers, then get the newly created vouchers and their details, format them on an html page and print. I can help with how to use the API client but not with the other elements; that comes down to basic HTML, CSS and PHP skills.
from unifi-api-browser.
@tirannilakshe FYI, there was a bug in the create_vouchers()
function/method that is now fixed.
from unifi-api-browser.
i have done voucher creating. but there is a little problem. that i can only create one time use vouchers only. how can i generate multi use vouchers
from unifi-api-browser.
Are you able to create them in the controller? If so, how? I don't use them myself....
from unifi-api-browser.
yes. when i create voucher in controller there is a option to select multi
use
On Mon, Nov 7, 2016 at 10:49 PM, malle-pietje [email protected]
wrote:
Are you able to create them in the controller? If so, how? I don't use
them myself....—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkb_BRkttyEqyAFd3Ozf6l0ShfwDAFuks5q7120gaJpZM4JrGXd
.
from unifi-api-browser.
from unifi-api-browser.
Ah, I see. Let me see how to efficiently enable this in the API client.
from unifi-api-browser.
there are some other things also how to delete vouchers, can i block and unblock guest by mac address
from unifi-api-browser.
I've added the multi-use/single-use option to the create_voucher()
function below:
/**
* Create voucher(s)
* -----------------
* returns an array of vouchers codes (NOTE: without the "-" in the middle) by calling the stat_voucher method
* required parameter <minutes> = minutes the voucher is valid after activation
* optional parameter <number_of_vouchers_to_create> = number of vouchers to create, default value is 1
* optional parameter <quota> = single-use or multi-use vouchers, string value '0' is for multi-use, '1' is for single-use
* optional parameter <note> = note text to add to voucher when printing
* optional parameter <up> = upload speed limit in kbps
* optional parameter <down> = download speed limit in kbps
* optional parameter <MBytes> = data transfer limit in MB
*/
public function create_voucher($minutes, $number_of_vouchers_to_create = 1, $quota = '0', $note = NULL, $up = NULL, $down = NULL, $MBytes = NULL) {
if (!$this->is_loggedin) return FALSE;
$return = array();
$json = array('cmd' => 'create-voucher', 'expire' => $minutes, 'n' => $number_of_vouchers_to_create, 'quota' => $quota);
/**
* if we have received values for note/up/down/MBytes we append them to the payload array to be submitted
*/
if (isset($note)) $json['note'] = trim($note);
if (isset($up)) $json['up'] = $up;
if (isset($down)) $json['down'] = $down;
if (isset($MBytes)) $json['bytes'] = $MBytes;
$json = json_encode($json);
$content_decoded = json_decode($this->exec_curl($this->baseurl.'/api/s/'.$this->site.'/cmd/hotspot','json='.$json));
if ($content_decoded->meta->rc == 'ok') {
if (is_array($content_decoded->data)) {
$obj = $content_decoded->data[0];
foreach ($this->stat_voucher($obj->create_time) as $voucher) {
$return[]= $voucher->code;
}
}
}
return $return;
}
I would appreciate if you could test this in your environment and report back whether this works or not.
TIA
from unifi-api-browser.
@tirannilakshe A function/method to delete vouchers can certainly be added, I will do that with the new release of the API client which will also include the improved create_voucher()
function after your confirmation that the above modification works.
For blocking/unblocking clients the block_sta()
and unblock_sta()
functions should do the trick. Have you already tried that?
from unifi-api-browser.
You're welcome. Thanks for the feedback; I'll update the class and add the voucher delete function shortly.
from unifi-api-browser.
@tiransa I have pushed a new version of the API client class and the API browser tool. Could you please check whether the new revoke_voucher()
function/method does what you wanted to achieve with regard to voucher deletion?
from unifi-api-browser.
Thanks for the feedback. For disconnect/extend, see my comment from 2 days ago.
from unifi-api-browser.
hello, can i create hotspot operator from this API Class
from unifi-api-browser.
that has not yet been implemented, only the function to list the operators list_hotspotop()
from unifi-api-browser.
can you do that soon please
On Mon, Nov 21, 2016 at 6:01 PM, malle-pietje [email protected]
wrote:
that has not yet been implemented, only the function to list the operators
list_hotspotop()—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkb_HWScXzUSPbAFwUg1X_RdW4zkke4ks5rAY8PgaJpZM4JrGXd
.
from unifi-api-browser.
I'm quite busy at the moment so this will take at least a week or two
from unifi-api-browser.
ok i will wait for that. thank you
On Mon, Nov 21, 2016 at 8:16 PM, malle-pietje [email protected]
wrote:
I'm quite busy at the moment so this will take at least a week or two
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkb_AkVsYrVUfzgD4wh3dEXFZRPKarFks5rAa7igaJpZM4JrGXd
.
from unifi-api-browser.
@tiransa If it works I will include it in the release I have ready for the API Browser and the API client class.
from unifi-api-browser.
Added create_hotspotop()
function/method several commits ago.
from unifi-api-browser.
Related Issues (20)
- 24hr usage HOT 2
- Any documentation available? HOT 2
- All devices HOT 3
- Removing users across all sites HOT 1
- UI Cloud Controller integration HOT 3
- Permission denied (13) when loading sites HOT 9
- Not setting any users in users.php blocks login instead of bypassing auth. HOT 5
- Default Site / Collection HOT 4
- Connection Error HOT 2
- How can I see all energy (watts) being usage on the network HOT 1
- UniFi controller login failure HOT 4
- Is there any way to display the results directly? HOT 4
- API IP from VPN HOT 7
- UDM Pro firmware beta version 1.11.0-14 and 1.11.0-15 HOT 2
- API does'nt work need help HOT 7
- Access to WLAN password HOT 15
- Possible issue with CORS HOT 3
- Demo not working HOT 2
- Unifi 7.0 Controller API Issue HOT 3
- Node lacks support for Ubiquiti power strips and plugs. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unifi-api-browser.