Re: [PacketFence-users] JSON RPC Querys...

2015-06-11 Thread James Rouzier
That is correct all you would have to do is add a new sub in api.pm and 
tag it as Public.


Example

sub my_new_funk :Public {
   my ($class,@params) = @_;
   return Stop, Hammer Time ,@params;
}

curl -v -H Content-Type: application/json-rpc -H Request: 
my_new_funk -X POST -d 
'{params:[timdenike],jsonrpc:2.0,method:my_new_funk, id : 
0}' http://localhost:9090/


The response will be the following

{jsonrpc:2.0,id:0,result:[Stop, Hammer Time,timdenike]}




James Rouzier
jrouz...@inverse.ca :: +1.514.755.3630  ::  http://www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
(http://www.packetfence.org)

On 2015-06-11 10:49 AM, Tim DeNike wrote:

Sweet.. That worked.

What would I do if I wanted to add more API functionality.. For 
instance, looking up device location by IP.  Looks like id have to add 
a sub in api.pm http://api.pm calling pf::node::node_search.


Long story short: To handle routing of E911 calls for phones we want 
to write hooks into our Asterisk PBX system to dynamically query 
physical location of phones based on the IP of the SIP registration 
and route the E911 calls and adjust CID information with location 
information.



On Thu, Jun 11, 2015 at 9:30 AM, James Rouzier jrouz...@inverse.ca 
mailto:jrouz...@inverse.ca wrote:


Tim DeNike,

To see the response back you must set the id in the jsonrpc request.

Here are some examples.

node_information

curl -v -H Content-Type: application/json-rpc -H Request:
register_node -X POST -d

'{params:[mac,00:11:22:33:44:55],jsonrpc:2.0,method:node_information,
id:0}' http://localhost:9090/

view_person

curl -v -H Content-Type: application/json-rpc -H Request:
view_person -X POST -d
'{params:[timdenike],jsonrpc:2.0,method:view_person,
id : 0}' http://localhost:9090/

James Rouzier
jrouz...@inverse.ca  mailto:jrouz...@inverse.ca  ::+1.514.755.3630  
tel:%2B1.514.755.3630   ::http://www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
(http://www.packetfence.org)

On 2015-06-10 5:23 PM, Tim DeNike wrote:

OK.. I can't seem to figure out how to PULL data from packet
fence with the web services API.

I can trigger events with it like so:

curl -v -H Content-Type: application/json-rpc -H Request:
register_node -X POST -d

'{params:[mac,00:11:22:33:44:55,pid,timdenike,category,business],jsonrpc:2.0,method:register_node}'
http://localhost:9090/

This does what you'd think.. Registers the node.

But how do I retrieve and use the node_information or
view_person api commands.

Im trying to integrate packet fence into an ISP
billing/accounting system and need to have the 2 fully talking..
Ive got it part way done.. Just trying to fill in the gaps.





--


___
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net  
mailto:PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users


  * French - detected
  * Afrikaans
  * Albanian
  * Arabic
  * Belarusian
  * Bulgarian
  * Catalan
  * Chinese
  * Chinese (Simplified)
  * Chinese (Traditional)
  * Croatian
  * Czech
  * Danish
  * Dutch
  * English
  * Estonian
  * Filipino
  * Finnish
  * French
  * Galician
  * German
  * Greek
  * Hebrew
  * Haitian Creole
  * Hindi
  * Hungarian
  * Icelandic
  * Indonesian
  * Irish
  * Italian
  * Japanese
  * Korean
  * Latvian
  * Lithuanian
  * Macedonian
  * Malay
  * Maltese
  * Norwegian
  * Persian
  * Polish
  * Portuguese
  * Portuguese (Portugal)
  * Romanian
  * Russian
  * Serbian
  * Slovak
  * Slovenian
  * Spanish
  * Swahili
  * Swedish
  * Thai
  * Turkish
  * Ukrainian
  * Vietnamese
  * Welsh
  * Yiddish

  * Afrikaans
  * Albanian
  * Arabic
  * Belarusian
  * Bulgarian
  * Catalan
  * Chinese
  * Chinese (Simplified)
  * Chinese (Traditional)
  * Croatian
  * Czech
  * Danish
  * Dutch
  * English
  * Estonian
  * Filipino
  * Finnish
  * French
  * Galician
  * German
  * Greek
  * Hebrew
  * Haitian Creole
  * Hindi
  * Hungarian
  * Icelandic
  * Indonesian
  * Irish
  * Italian
  * Japanese
  * Korean
  * Latvian
  * Lithuanian
  * Macedonian
  * Malay
  * Maltese
  * Norwegian
  * Persian
  * Polish
  * Portuguese
  * Portuguese (Portugal)
  * Romanian
  * Russian
  * Serbian
  * Slovak
  * Slovenian
  * Spanish
  * Swahili
  * Swedish
 

Re: [PacketFence-users] JSON RPC Querys...

2015-06-11 Thread Tim DeNike
Sweet.. That worked.

What would I do if I wanted to add more API functionality.. For instance,
looking up device location by IP.  Looks like id have to add a sub in api.pm
calling pf::node::node_search.

Long story short: To handle routing of E911 calls for phones we want to
write hooks into our Asterisk PBX system to dynamically query physical
location of phones based on the IP of the SIP registration and route the
E911 calls and adjust CID information with location information.


On Thu, Jun 11, 2015 at 9:30 AM, James Rouzier jrouz...@inverse.ca wrote:

  Tim DeNike,

 To see the response back you must set the id in the jsonrpc request.

 Here are some examples.

 node_information

 curl -v -H Content-Type: application/json-rpc -H Request:
 register_node -X POST -d
 '{params:[mac,00:11:22:33:44:55],jsonrpc:2.0,method:node_information,
 id:0}' http://localhost:9090/

 view_person

 curl -v -H Content-Type: application/json-rpc -H Request: view_person
 -X POST -d '{params:[timdenike],jsonrpc:2.0,method:view_person,
 id : 0}' http://localhost:9090/ http://localhost:9090/

 James rouzierjrouz...@inverse.ca :: +1.514.755.3630  ::  http://www.inverse.ca
 Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
 (http://www.packetfence.org)

 On 2015-06-10 5:23 PM, Tim DeNike wrote:

 OK.. I can't seem to figure out how to PULL data from packet fence with
 the web services API.

  I can trigger events with it like so:

  curl -v -H Content-Type: application/json-rpc -H Request:
 register_node -X POST -d
 '{params:[mac,00:11:22:33:44:55,pid,timdenike,category,business],jsonrpc:2.0,method:register_node}'
 http://localhost:9090/

  This does what you'd think.. Registers the node.

  But how do I retrieve and use the node_information or view_person
 api commands.

  Im trying to integrate packet fence into an ISP billing/accounting
 system and need to have the 2 fully talking.. Ive got it part way done..
 Just trying to fill in the gaps.




 --



 ___
 PacketFence-users mailing 
 listPacketFence-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/packetfence-users



- French - detected
- Afrikaans
- Albanian
- Arabic
- Belarusian
- Bulgarian
- Catalan
- Chinese
- Chinese (Simplified)
- Chinese (Traditional)
- Croatian
- Czech
- Danish
- Dutch
- English
- Estonian
- Filipino
- Finnish
- French
- Galician
- German
- Greek
- Hebrew
- Haitian Creole
- Hindi
- Hungarian
- Icelandic
- Indonesian
- Irish
- Italian
- Japanese
- Korean
- Latvian
- Lithuanian
- Macedonian
- Malay
- Maltese
- Norwegian
- Persian
- Polish
- Portuguese
- Portuguese (Portugal)
- Romanian
- Russian
- Serbian
- Slovak
- Slovenian
- Spanish
- Swahili
- Swedish
- Thai
- Turkish
- Ukrainian
- Vietnamese
- Welsh
- Yiddish


- Afrikaans
- Albanian
- Arabic
- Belarusian
- Bulgarian
- Catalan
- Chinese
- Chinese (Simplified)
- Chinese (Traditional)
- Croatian
- Czech
- Danish
- Dutch
- English
- Estonian
- Filipino
- Finnish
- French
- Galician
- German
- Greek
- Hebrew
- Haitian Creole
- Hindi
- Hungarian
- Icelandic
- Indonesian
- Irish
- Italian
- Japanese
- Korean
- Latvian
- Lithuanian
- Macedonian
- Malay
- Maltese
- Norwegian
- Persian
- Polish
- Portuguese
- Portuguese (Portugal)
- Romanian
- Russian
- Serbian
- Slovak
- Slovenian
- Spanish
- Swahili
- Swedish
- Thai
- Turkish
- Ukrainian
- Vietnamese
- Welsh
- Yiddish

#14de2d20dba867bb_


 --

 ___
 PacketFence-users mailing list
 PacketFence-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/packetfence-users


--
___
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users


Re: [PacketFence-users] JSON RPC Querys...

2015-06-11 Thread James Rouzier

Tim DeNike,

To see the response back you must set the id in the jsonrpc request.

Here are some examples.

node_information

curl -v -H Content-Type: application/json-rpc -H Request: 
register_node -X POST -d 
'{params:[mac,00:11:22:33:44:55],jsonrpc:2.0,method:node_information, 
id:0}' http://localhost:9090/


view_person

curl -v -H Content-Type: application/json-rpc -H Request: 
view_person -X POST -d 
'{params:[timdenike],jsonrpc:2.0,method:view_person, id : 
0}' http://localhost:9090/http://localhost:9090/


James Rouzier
jrouz...@inverse.ca :: +1.514.755.3630  ::  http://www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
(http://www.packetfence.org)

On 2015-06-10 5:23 PM, Tim DeNike wrote:
OK.. I can't seem to figure out how to PULL data from packet fence 
with the web services API.


I can trigger events with it like so:

curl -v -H Content-Type: application/json-rpc -H Request: 
register_node -X POST -d 
'{params:[mac,00:11:22:33:44:55,pid,timdenike,category,business],jsonrpc:2.0,method:register_node}' 
http://localhost:9090/


This does what you'd think.. Registers the node.

But how do I retrieve and use the node_information or view_person 
api commands.


Im trying to integrate packet fence into an ISP billing/accounting 
system and need to have the 2 fully talking.. Ive got it part way 
done.. Just trying to fill in the gaps.





--


___
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users


 * French - detected
 * Afrikaans
 * Albanian
 * Arabic
 * Belarusian
 * Bulgarian
 * Catalan
 * Chinese
 * Chinese (Simplified)
 * Chinese (Traditional)
 * Croatian
 * Czech
 * Danish
 * Dutch
 * English
 * Estonian
 * Filipino
 * Finnish
 * French
 * Galician
 * German
 * Greek
 * Hebrew
 * Haitian Creole
 * Hindi
 * Hungarian
 * Icelandic
 * Indonesian
 * Irish
 * Italian
 * Japanese
 * Korean
 * Latvian
 * Lithuanian
 * Macedonian
 * Malay
 * Maltese
 * Norwegian
 * Persian
 * Polish
 * Portuguese
 * Portuguese (Portugal)
 * Romanian
 * Russian
 * Serbian
 * Slovak
 * Slovenian
 * Spanish
 * Swahili
 * Swedish
 * Thai
 * Turkish
 * Ukrainian
 * Vietnamese
 * Welsh
 * Yiddish

 * Afrikaans
 * Albanian
 * Arabic
 * Belarusian
 * Bulgarian
 * Catalan
 * Chinese
 * Chinese (Simplified)
 * Chinese (Traditional)
 * Croatian
 * Czech
 * Danish
 * Dutch
 * English
 * Estonian
 * Filipino
 * Finnish
 * French
 * Galician
 * German
 * Greek
 * Hebrew
 * Haitian Creole
 * Hindi
 * Hungarian
 * Icelandic
 * Indonesian
 * Irish
 * Italian
 * Japanese
 * Korean
 * Latvian
 * Lithuanian
 * Macedonian
 * Malay
 * Maltese
 * Norwegian
 * Persian
 * Polish
 * Portuguese
 * Portuguese (Portugal)
 * Romanian
 * Russian
 * Serbian
 * Slovak
 * Slovenian
 * Spanish
 * Swahili
 * Swedish
 * Thai
 * Turkish
 * Ukrainian
 * Vietnamese
 * Welsh
 * Yiddish

javascript:void(0);#
--
___
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users


[PacketFence-users] JSON RPC Querys...

2015-06-10 Thread Tim DeNike
OK.. I can't seem to figure out how to PULL data from packet fence with the
web services API.

I can trigger events with it like so:

curl -v -H Content-Type: application/json-rpc -H Request: register_node
-X POST -d
'{params:[mac,00:11:22:33:44:55,pid,timdenike,category,business],jsonrpc:2.0,method:register_node}'
http://localhost:9090/

This does what you'd think.. Registers the node.

But how do I retrieve and use the node_information or view_person api
commands.

Im trying to integrate packet fence into an ISP billing/accounting system
and need to have the 2 fully talking.. Ive got it part way done.. Just
trying to fill in the gaps.
--
___
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users