NAME
Webservice::Vtiger - Interface to vtiger5.2 webservices
VERSION
Version 0.01
SYNOPSIS
Class that handles the webservice interface to vtiger.
The basic object in that transactions is $session that holds sessionName and userId values. This values will be used to perform request services
use Webservice::Vtiger;
my $vt = new Webservice::Vtiger();
my $usermane = 'admin';
my $pin = 'f956n34fc6';
my $session = $vt->getSession($username, $pin);
With a 'Session Id' string we can perform querys:
my $contacts = $vt->query(
$session->{'sessionName'},
"select * from Contacts;"
);
CRUD
To change vtiger objects we need the userId holded by our session object.
CREATE
# create a new contact
my $ctcData = {
'assigned_user_id'=> $session->{'userId'},
'lastname' => 'Filipo'
};
my $newContact = $vt->create(
$session->{'sessionName'},
'Contacts',
$ctcData
);
RETRIEVE
my $retrieved =$vt->retrieve($session->{'sessionName'}, $contactId);
UPDATE
$retrieved->{'lastname'} = "Filapo";
$vt->update($session->{'sessionName'},$retrieved)
DELETE
my $deleted =$vt->delete($session->{'sessionName'}, $contactId);
SUBROUTINES/METHODS
new
A Webservice::Vtiger object can be instantiated by the new method.
The module instance has blessed 4 attributes:
ua: the browser
Instance of LWP::UserAgent
json: the json handler
Instance of JSON
ctx: the MD5 handler
Instance of Digest::MD5
url: the url of vtiger5.2 CRM
getSession
Returns a session object.
A session holds sessionName and userId values.
This values must be used to identify the user in web services requests.
my $sessionName = $session->{'sessionName'};
my $userId = $session->{'userId'};
describe
Returns the vtiger module descripton.
my $description = $vt->describe{$sessionName, $module};
my @fieldNames = @{$description->{'fields'}};
The description consists of the following fields:
label - The label used for the name of the module.
name - The name of the module.
createable - A boolean value specifying whether the object can be created.
updateable - A boolean value specifying whether the object can be updated.
deleteable - A boolean value specifying whether the object can be deleted.
retrieveable - A boolean value specifying whether the object can be retrieved.
fields - An array containing the field names and their type information.
Each element in the fields array describes a particular field in the object.
name - The name of the field, as used internally by vtiger.
label - The label used for displaying the field name.
mandatory - This is a boolean that specifies whether the field is mandatory, mandatory fields must be provided when creating a new object.
type - An map that describes the type information for the field.
default - The default value for the field.
nillable - A boolean that specifies whether the field can be set to null.
editable - A boolean that specifies whether the field can be modified.
The type field is of particular importance as it describes what type of the field is. This is an map that will contain at the least an element called name which is the name of the type. The name could be one of the following.
string - A one line text field.
text - A multiline text field.
integer - A non decimal number field.
double - A field for for floating point numbers.
boolean - A boolean field, can have the values true or false.
time - A string of the format hh:mm, format is based on the user's settings time format.
date - A string representing a date, the type map will contain another element called format which is the format in which the value of this field is expected, its based on the user's settings date format.
datetime - A string representing the date and time, the format is base on the user's settings date format.
autogenerated - Thes are fields for which the values are generated automatically by vtiger, this is usually an object's id field.
reference - A field that shows a relation to another object, the type map will contain another element called refersTo which is an array containing the name of modules of which the field can point to.
picklist - A field that can a hold one of a list of values, the map will contain two elements, picklistValues which is a list of possible values, and defaultValue which is the default value for the picklist.
multipicklist - A picklist field where multiple values can be selected.
phone - A field for storing phone numbers
email - A field for storing email ids
url - A field for storing urls
skype - A field for storing skype ids or phone numbers.
password - A field for storing passwords.
owner - A field for defining the owner of the field. which could be a group or individual user.
create
delete
update
query
retrieve
listModules
AUTHOR
Monsenhor, <monsenhor at cpan.com>
BUGS
Please report any bugs or feature requests to bug-webservice-vtiger at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Vtiger. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WebService::Vtiger
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2011 Monsenhor.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.