Hello, there is not yet documentation on the webAPI but it´s really easy to extend and modify. You can change the webapi config in Configuration -> Webservices.
Check the file api.pm and you will see what is possible to do. Also take a look at https://github.com/inverse-inc/packetfence/blob/feature/wmi/lib/pf/api.pm , we added new api function. Also here an example to talk to the webapi with powershell: $url = "https://IP_PF:9090/" $username = "webservice" # Username for the webservice $password = "webservice" # Password for the webservice [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} $command = '{"jsonrpc": "2.0", "id": "2", "method": "node_information", "params": [{"mac": "00:11:22:33:44:55"}]}' $bytes = [System.Text.Encoding]::ASCII.GetBytes($command) $web = [System.Net.WebRequest]::Create($url) $web.Method = "POST" $web.ContentLength = $bytes.Length $web.ContentType = "application/json-rpc" $web.Credentials = new-object System.Net.NetworkCredential($username, $password) $stream = $web.GetRequestStream() $stream.Write($bytes,0,$bytes.Length) $resp = $web.GetResponse() $RespStream = $resp.GetResponseStream() #Create a stream to write to the file system. $Target = "C:\json.txt" $Wrt = [System.IO.File]::Create($Target) #Create the buffer for copying data. $Buffer = New-Object Byte[] 1024 Do { $BytesRead = $RespStream.Read($Buffer, 0, $Buffer.Length) $Wrt.Write($Buffer, 0, $BytesRead) } While ($BytesRead -gt 0) #Close the stream. $RespStream.Close() $RespStream.Dispose() #Flush and close the writer. $Wrt.Flush() $Wrt.Close() $Wrt.Dispose() Regards Fabrice Le 2015-01-19 01:02, CF Leong a écrit : > Is there any documentation which describes how to use the webAPI, and > if neccessary, how to extend/modify it? I cannot seem to find much > information about it, besides how to configure the username, password, > host, protocol and port number. > > > ------------------------------------------------------------------------------ > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > > > _______________________________________________ > PacketFence-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/packetfence-users -- Fabrice Durand [email protected] :: +1.514.447.4918 (x135) :: www.inverse.ca Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence (http://packetfence.org)
0xF78F957E.asc
Description: application/pgp-keys
------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet
_______________________________________________ PacketFence-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/packetfence-users
