From c39d6e73a98427d653e3d019aaa90f16bc1b6380 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 21 Jul 2015 19:16:06 -0700 Subject: [PATCH] self-service API list_contacts doc, RT#37372 --- FS/FS/ClientAPI/MyAccount/contact.pm | 2 +- bin/xmlrpc-list_contacts | 28 +++++++++++++++++++ fs_selfservice/FS-SelfService/SelfService.pm | 40 ++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 bin/xmlrpc-list_contacts diff --git a/FS/FS/ClientAPI/MyAccount/contact.pm b/FS/FS/ClientAPI/MyAccount/contact.pm index 5690f867b..31bbb0cb1 100644 --- a/FS/FS/ClientAPI/MyAccount/contact.pm +++ b/FS/FS/ClientAPI/MyAccount/contact.pm @@ -82,7 +82,7 @@ sub list_contacts { #TODO: contact phone numbers 'comment' => $_->comment, 'selfservice_access' => $_->selfservice_access, - 'disabled' => $contact->disabled, + #'disabled' => $contact->disabled, }; } $cust_main->cust_contact ); diff --git a/bin/xmlrpc-list_contacts b/bin/xmlrpc-list_contacts new file mode 100755 index 000000000..ffe2a31ad --- /dev/null +++ b/bin/xmlrpc-list_contacts @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use strict; +use Frontier::Client; +use Data::Dumper; + +my( $email, $password ) = @ARGV; + +my $uri = new URI 'http://localhost:8080/'; + +my $server = new Frontier::Client ( 'url' => $uri ); + +my $login_result = $server->call( + 'FS.ClientAPI_XMLRPC.login', + 'email' => $email, + 'password' => $password, +); +die $login_result->{'error'}."\n" if $login_result->{'error'}; + +my $list_result = $server->call( + 'FS.ClientAPI_XMLRPC.list_contacts', + 'session_id' => $login_result->{'session_id'}, +); +die $list_result->{'error'}."\n" if $list_result->{'error'}; + +print Dumper($list_result); + +1; diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index 06dcc2b05..e01d17b6a 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -1375,6 +1375,46 @@ error message, or empty on success. =item list_contacts +Takes a hash reference as parameter with a single key, B. + +Returns a hash reference with two parameters: B, which contains an error +message, or empty on success, and B, a list of contacts. + +B is an array reference of hash references (i.e. an array of structs, + in XML-RPC). Each hash reference (struct) has the following keys: + +=over4 + +=item contactnum + +=item class + +Contact class name (contact type). + +=item first + +First name + +=item last + +Last name + +=item title + +Position ("Director of Silly Walks"), NOT honorific ("Mr." or "Mrs.") + +=item emailaddress + +Comma-separated list of email addresses + +=item comment + +=item selfservice_access + +Y when enabled + +=back + =item edit_contact Updates information for the currently-logged in contact, or (optionally) the -- 2.11.0