NAME
WebService::NetSuite::SuiteTalk - NetSuite SOAP interface that caches compiled calls in memory
VERSION
version 0.006
SYNOPSIS
use WebService::NetSuite::SuiteTalk;
my $suitetalk = WebService::NetSuite::SuiteTalk->new(
account_id => '12345678',
email_address => 'netsuite_customer@example.com',
password => 'sekrit',
xsi_auto => 1,
);
my $answer_ref = $suitetalk->changePassword(
changePassword => {
currentPassword => 'sekrit',
newPassword => 'tirkes',
newPassword2 => 'tirkes',
justThisAccount => 'true',
},
);
DESCRIPTION
This class provides an in-memory lazy cache for compiled SOAP calls using NetSuite SuiteTalk web services. The first call to any SOAP method uses XML::Compile::WSDL11 to compile and execute that method against the specified NetSuite SuiteTalk service; subsequent calls can vary the parameters but will use the same compiled code.
METHODS
Available method names are dynamically loaded from the SuiteTalk WSDL file's operations, and can be passed either a hash or reference to a hash with the necessary parameters. In scalar context they return a reference to a hash containing the results of the SOAP call; in list context they return the results hashref and an XML::Compile::SOAP::Trace object suitable for debugging and exception handling.
If there is no result then an exception will be thrown.
Special note about list methods
NetSuite's list methods (e.g., addList
, deleteList
, getList
, initializeList
, updateList
, upsertList
, and their asynchronous counterparts asyncAddList
, asyncDeleteList
, asyncGetList
, asyncInitializeList
, asyncUpdateList
, asyncUpsertList
) may all run into the various governance measures implemented to prevent web serviced from adversely affecting other users or the user experience. This module tries to mitigate this by detecting when the ExceededRecordCountFault
or ExceededRequestSizeFault
errors are triggered, and when detected splitting the record list in half and sending it as separate requests, repeating if necessary. Thus the results of list methods are returned as an array of answers and traces, rather than a simple paired answer and trace. This is reflected in the examples below.
As of this writing the following operations are published in the NetSuite SuiteTalk API 2014.2 schema. Consult NetSuite's Help Center for full documentation on input and output parameters for each operation.
add
Example:
use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->add( record => {
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Joseph',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'joe@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
} );
addList
Example:
use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = ( $suitetalk->addList( record => [
{
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Joseph',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'joe@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
},
{
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Jennifer',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'jen@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
},
] ) )[0][0];
asyncAddList
asyncDeleteList
asyncGetList
asyncInitializeList
asyncSearch
asyncUpdateList
asyncUpsertList
attach
changeEmail
changePassword
Example:
my $answer_ref = $suitetalk->changePassword(
changePassword => {
currentPassword => 'sekrit',
newPassword => 'tirkes',
newPassword2 => 'tirkes',
justThisAccount => 'true',
},
);
checkAsyncStatus
delete
deleteList
detach
get
Example:
my $answer_ref = $suitetalk->get( baseRef => {
XSI_TYPE => 'platformCore:RecordRef',
type => 'nonInventorySaleItem',
externalId => '12345',
} );
getAll
getAsyncResult
getBudgetExchangeRate
getConsolidatedExchangeRate
getCurrencyRate
getCustomizationId
getDataCenterUrls
Example:
my $answer_ref = $suitetalk->getDataCenterUrls(account => '1234567');
getDeleted
getItemAvailability
getList
getPostingTransactionSummary
getSavedSearch
getSelectValue
Example:
my $answer_ref = $suitetalk->getSelectValue(
pageIndex => 1,
fieldDescription => { recordType => 'customer', field => 'leadSource' },
);
getServerTime
initialize
Example:
my $answer_ref = $suitetalk->initialize( initializeRecord => {
type => 'creditMemo',
reference => { internalId => '12345', type => 'invoice' },
} );
initializeList
login
logout
mapSso
search
Example:
my $answer_ref = $suitetalk->search( searchRecord => {
XSI_TYPE => 'platformCommon:TransactionSearchBasic',
type => {
operator => 'anyOf',
searchValue => ['invoice'],
},
} );
searchMore
searchMoreWithId
searchNext
ssoLogin
update
Example:
my $answer_ref = $suitetalk->update( record => {
XSI_TYPE => 'tranCust:CreditMemo',
internalId => '12345'
applyList => {
replaceAll => 0,
apply => {
apply => 1,
total => '1.00',
doc => '12346',
line => 0,
},
},
} );
updateInviteeStatus
updateInviteeStatusList
updateList
upsert
Example:
use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = $suitetalk->upsert( record => {
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Joseph',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'joe@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
} );
upsertList
Example:
use Moo;
with 'WebServices::NetSuite::SuiteTalk::Role::Country';
my $answer_ref = ( $suitetalk->upsertList( record => [
{
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Joseph',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'joe@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
},
{
XSI_TYPE => 'listRel:Customer',
isPerson => 1,
firstName => 'Jennifer',
middleName => 'Random',
lastName => 'Netsuite',
companyName => 'Acme',
email => 'jen@example.com',
addressbookList => [
{ defaultBilling => 1,
addr1 => '123 Main Street',
city => 'Anytown',
state => 'CA',
zip => '99999',
country => code2country('us'),
},
],
},
] ) )[0][0];
OTHER METHODS AND ATTRIBUTES
Because this class consumes the WebService::NetSuite::SuiteTalk::Role::Connection
role, it also has that role's attributes and methods. For example, you can use the user_agent
attribute to access the LWP::UserAgent used to retrieve and call the SuiteTalk service, or the wsdl
method to access the underlying XML::Compile::WSDL11 object.
TESTING
The unit tests included with this distribution need to authenticate to a NetSuite account with SuiteTalk Web Services enabled. To enable web services, use the NetSuite web user interface and select the "Setup" menu, followed by "Company", followed by "Enable Features", then select the "SuiteCloud" tab. Make sure the "Web Services" checkbox is marked and select the "Save" button.
In addition, you need to set the following environment variables in order to run the unit tests:
PERL_TEST_NETSUITE_ACCOUNT
PERL_TEST_NETSUITE_EMAIL
PERL_TEST_NETSUITE_PASSWORD
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc WebService::NetSuite::SuiteTalk
Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl module documentation.
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
CPAN Forum
The CPAN Forum is a web forum for discussing Perl modules.
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
http://cpants.cpanauthors.org/dist/WebService-NetSuite-SuiteTalk
CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/W/WebService-NetSuite-SuiteTalk
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=WebService-NetSuite-SuiteTalk
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=WebService::NetSuite::SuiteTalk
Bugs / Feature Requests
Please report any bugs or feature requests through the web interface at https://github.com/mjgardner/webservice-netsuite-suitetalk/issues. You will be automatically notified of any progress on the request by the system.
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/mjgardner/webservice-netsuite-suitetalk
git clone git://github.com/mjgardner/webservice-netsuite-suitetalk.git
AUTHOR
Mark Gardner <mjgardner@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by ZipRecruiter.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.