Thank you very much.
I tried some commands, and I got “200 OK” as an answer and an empty “result”, 
but nothing hapened on the DB.
For example (from Linux, with cURL):

> curl -kv -u `awk -F= '/^\[/ { ws=0; } ; /^\[webservices\]/ {ws=1} ; /^user/ { 
> if (ws == 1) { username=$2 ; }} ; /^pass/ {if (ws == 1) { pass=$2; }} 
> /usr/local/pf/conf/pf.conf` -H "content-type: application/json-rpc" 
> https://IP:9090/ -d '{"jsonrpc": "2.0", "id": "2", "method": 
> "unreg_node_for_pid", "params": [{"pid": “XXX"}]}’

or
> curl -kv -u `awk -F= '/^\[/ { ws=0; } ; /^\[webservices\]/ {ws=1} ; /^user/ { 
> if (ws == 1) { username=$2 ; }} ; /^pass/ {if (ws == 1) { pass=$2; }} 
> /usr/local/pf/conf/pf.conf` -H "content-type: application/json-rpc" 
> https://IP:9090/ -d '{"jsonrpc": "2.0", "id": "2", "method": "modify_person", 
> "params": [{"pid": "robert","email":"[email protected]"}]}'

Nicola
 
Il giorno 19/feb/2015, alle ore 16:35, Fabrice DURAND <[email protected]> ha 
scritto:

> Hello Nicola,
> 
> it´s not possible yet to modify a person from the web services but it´s
> really easy to add this feature.
> Add something like this in lib/pf/api.pm:
> 
> =head2 modify_person
> Add and modify a person
> =cut
> 
> sub modify_person : Public {
>    my ($class, %postdata )  = @_;
>    my @require = qw(pid);
>    my @found = grep {exists $postdata{$_}} @require;
>    return unless @require == @found;
> 
>    pf::person::person_modify($postdata{'pid'}, %postdata);
>    return;
> }
> 
> 
> Also here a example to use the web api from 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": "modify_person",
> "params": [{"pid": "robert","email":"[email protected]"}]}'
> 
> $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-02-19 10:18, Nicola Canepa a écrit :
>> Hello.
>> I cannot find much documentation for the available web services or JSON-RPC 
>> interfaces.
>> Is it possible to create or modify users for wifi access through one of 
>> these interfaces?
>> Where can I find the API or an example?
>> 
>> Thank you.
>> 
>> Nicola Canepa
>> Phone: +39-0522-399-3474
>> [email protected]
>> 
>> -
>> Remember, remember, the 5th of November (V)
>> 
>> Il contenuto della presente comunicazione è riservato e destinato 
>> esclusivamente ai destinatari indicati. Nel caso in cui sia ricevuto da 
>> persona diversa dal destinatario sono proibite la diffusione, la 
>> distribuzione e la copia. Nel caso riceveste la presente per errore, Vi 
>> preghiamo di informarci e di distruggerlo e/o cancellarlo dal Vostro 
>> computer, senza utilizzare i dati contenuti. La presente comunicazione 
>> (comprensiva dei documenti allegati) non avrà valore di proposta 
>> contrattuale e/o accettazione di proposte provenienti dal destinatario, nè 
>> rinuncia o riconoscimento di diritti, debiti e/o crediti, nè sarà 
>> impegnativa, qualora non sia sottoscritto successivo accordo da chi può 
>> validamente obbligarci. Non deriverà alcuna responsabilità precontrattuale a 
>> ns. carico, se la presente non sia seguita da contratto sottoscritto dalle 
>> parti.
>> 
>> The content of the above communication is strictly confidential and reserved 
>> solely for the referred addressees. In the event of receipt by persons 
>> different from the addressee, copying, alteration and distribution are 
>> forbidden. If received by mistake we ask you to inform us and to destroy 
>> and/or delete from your computer without using the data herein contained. 
>> The present message (eventual annexes inclusive) shall not be considered a 
>> contractual proposal and/or acceptance of offer from the addressee, nor 
>> waiver recognizance of rights, debts  and/or credits, nor shall it be 
>> binding when not executed as a subsequent agreement by persons who could 
>> lawfully represent us. No pre-contractual liability shall apply to us when 
>> the present communication is not followed by any binding agreement between 
>> the parties.
>> 
>> 
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>> _______________________________________________
>> 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>------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk_______________________________________________
> PacketFence-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/packetfence-users

Nicola Canepa
Phone: +39-0522-399-3474
[email protected]

-
Remember, remember, the 5th of November (V)

Il contenuto della presente comunicazione è riservato e destinato 
esclusivamente ai destinatari indicati. Nel caso in cui sia ricevuto da persona 
diversa dal destinatario sono proibite la diffusione, la distribuzione e la 
copia. Nel caso riceveste la presente per errore, Vi preghiamo di informarci e 
di distruggerlo e/o cancellarlo dal Vostro computer, senza utilizzare i dati 
contenuti. La presente comunicazione (comprensiva dei documenti allegati) non 
avrà valore di proposta contrattuale e/o accettazione di proposte provenienti 
dal destinatario, nè rinuncia o riconoscimento di diritti, debiti e/o crediti, 
nè sarà impegnativa, qualora non sia sottoscritto successivo accordo da chi può 
validamente obbligarci. Non deriverà alcuna responsabilità precontrattuale a 
ns. carico, se la presente non sia seguita da contratto sottoscritto dalle 
parti.

The content of the above communication is strictly confidential and reserved 
solely for the referred addressees. In the event of receipt by persons 
different from the addressee, copying, alteration and distribution are 
forbidden. If received by mistake we ask you to inform us and to destroy and/or 
delete from your computer without using the data herein contained. The present 
message (eventual annexes inclusive) shall not be considered a contractual 
proposal and/or acceptance of offer from the addressee, nor waiver recognizance 
of rights, debts  and/or credits, nor shall it be binding when not executed as 
a subsequent agreement by persons who could lawfully represent us. No 
pre-contractual liability shall apply to us when the present communication is 
not followed by any binding agreement between the parties.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to