NAME

Snapforce::API - Perl module for simple use of the Snapforce API.

SYNOPSIS

use Snapforce::API;
blah blah blah

Description

This module acts as a simple in-between between a Perl user and the Snapforce API. All of this can be reasonably done by the end-user; this module is meant to simplify the process. Each call of fetchRecords performs an API call to Snapforce according to their API: https://www.snapforce.com/crm/resources/developers/api/

At the moment, only the "fetchRecords()" API function is implemented, but explicit calls to other methods are allowed with the "runAPI" function, as long as the appropriate parameters are passed. See /runAPI for more details.

Methods

new(Authuser, Authkey)

This is the constructor method for Snapforce::API. This method has two required parameters: the authentication username and authentication key provided by your Snapforce account.

fetchRecords([OPT => OPT_VALUE [...]])

Primary read-only function of the API. The options that are available for this method are available for all API call methods:

  • module

    The module the API call will be using. This value can be Leads, Accounts, Contacts, Opportunities, or Events.

  • status

    Can be set to either Active or Inactive

  • format

    This is the output format from the API call. At the moment, the Snapforce API itself only allows xml and txt as values.. When that changes, this module will be updated to support the additional types.

runAPI([OPT => OPT_VALUE [...]])

All of the other API functions prepare their data to be passed to this function, which is where the actual API call is made. The options that this accepts are the same as fetchRecords, but also includes a few others. runAPI should always be called with a method parameter, but if not, a warning will be thrown that it will default to fetchRecords. Methods such as inputRecords will also take other key=>value pairs in the form of $fieldname = $fieldvalue> as passed parameters.

parseXML(XML_DOC)

Not strictly required by this module, as you are free to deal with the returned xml from other methods yourself, but parseXML will turn the returned XML document (if format = 'xml'> is specified or no format is given) into a hash tree. For example: my %tree = parseXML($response); print $tree{'accounts'}{'account-12345'}{'account_name'};

This will output the account name of account 12345 from the returned xml document.

SEE ALSO

Please check the official Snapforce API documentation, located at https://www.snapforce.com/crm/resources/developers/api/ to get a list of all functions and parameters. Anything that this module doesn't specifically cover can still be explicitly called using the runAPI function.

AUTHOR

Gabriel Benamy, <gabrielbenamy@snapforce.com>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Snapforce

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 150:

You forgot a '=back' before '=head1'