Giter VIP home page Giter VIP logo

Comments (23)

tiransa avatar tiransa commented on May 18, 2024 1

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.

tiransa avatar tiransa commented on May 18, 2024 1

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.

malle-pietje avatar malle-pietje commented on May 18, 2024 1

@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.

malle-pietje avatar malle-pietje commented on May 18, 2024

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.

malle-pietje avatar malle-pietje commented on May 18, 2024

@tirannilakshe FYI, there was a bug in the create_vouchers() function/method that is now fixed.

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

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.

malle-pietje avatar malle-pietje commented on May 18, 2024

Are you able to create them in the controller? If so, how? I don't use them myself....

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

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.

tiransa avatar tiransa commented on May 18, 2024

untitled

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

Ah, I see. Let me see how to efficiently enable this in the API client.

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

there are some other things also how to delete vouchers, can i block and unblock guest by mac address

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

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.

malle-pietje avatar malle-pietje commented on May 18, 2024

@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.

malle-pietje avatar malle-pietje commented on May 18, 2024

You're welcome. Thanks for the feedback; I'll update the class and add the voucher delete function shortly.

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

@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.

malle-pietje avatar malle-pietje commented on May 18, 2024

Thanks for the feedback. For disconnect/extend, see my comment from 2 days ago.

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

hello, can i create hotspot operator from this API Class

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

that has not yet been implemented, only the function to list the operators list_hotspotop()

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

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.

malle-pietje avatar malle-pietje commented on May 18, 2024

I'm quite busy at the moment so this will take at least a week or two

from unifi-api-browser.

tiransa avatar tiransa commented on May 18, 2024

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.

malle-pietje avatar malle-pietje commented on May 18, 2024

@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.

malle-pietje avatar malle-pietje commented on May 18, 2024

Added create_hotspotop() function/method several commits ago.

from unifi-api-browser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.