This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Contacts in FreeAgent
Overview
The following operations allow you to work with contacts. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with contacts, see Sample configuration.
Operation | Description |
---|---|
Creates a new contact. | |
getContactById | Retrieves a single contact by ID. |
listContacts | Retrieves all contacts. |
Operation details
This section provides further details on the operations related to contacts.
Creating a new contact
The createContact
operation creates a new contact.
<freeagent.createContact> <organisationName>{$ctx:organisationName}</organisationName> <firstName>{$ctx:firstName}</firstName> <lastName>{$ctx:lastName}</lastName> <email>{$ctx:email}</email> <phoneNumber>{$ctx:phoneNumber}</phoneNumber> <address1>{$ctx:address1}</address1> <town>{$ctx:town}</town> <region>{$ctx:region}</region> <postcode>{$ctx:postcode}</postcode> <address2>{$ctx:address2}</address2> <address3>{$ctx:address3}</address3> <contactNameOnInvoices>{$ctx:contactNameOnInvoices}</contactNameOnInvoices> <country>{$ctx:country}</country> <salesTaxRegistrationNumber>{$ctx:salesTaxRegistrationNumber}</salesTaxRegistrationNumber> <usesContactInvoiceSequence>{$ctx:usesContactInvoiceSequence}</usesContactInvoiceSequence> </freeagent.createContact>
Properties
The name of the organization.organisationName:
The first name of the contact.firstName:
The last name of the contact.lastName:
The e-mail address of the contact.email:
The telephone number of the contact.phoneNumber:
The first address line of the contact.address1:
The town of the contact.town:
The region of the contact.region:
The post code of the contact.postcode:
The second address line of the contact.address2:
The third address line of the contact.address3:
The Boolean flag to indicate whether the contact name should be displayed in invoices.contactNameOnInvoices:
The country of the contact.country:
The sales tax registration number of the contact.salesTaxRegistrationNumber:
The Boolean flag to indicate use of the contact invoice sequence.usesContactInvoiceSequence:
Sample request
Following is a sample REST/JSON request that can be handled by the createContact operation.
{ "apiUrl" : "https://api.sandbox.freeagent.com", "accessToken" : "1YBpWH_SDwDUalF5Vv541uiW3zBIkjccmh817gRnV", "organisationName" : "Virtusa", "firstName" : "John", "lastName" : "Carter", "email" : "john.carter@gmail.com", "phoneNumber" : "98869558", "address1" : "234", "town" : "Colombo", "region" : "Western", "postcode" : "112233", "address2" : "Silva Avenue", "address3" : "Dematagoda", "contactNameOnInvoices" : "false", "country" : "Sri Lanka", "salesTaxRegistrationNumber" : "1311", "usesContactInvoiceSequence" : "true" }
Related FreeAgent documentation
https://dev.freeagent.com/docs/contacts#create-a-contact
Retrieving a single contact by ID
The
operation retrieves a single contact by ID.getContactById
<freeagent.getContactById> <id>{$ctx:id}</id> </freeagent.getContactById>
Properties
The ID of the contact.id:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.getContactById
{ "apiUrl" : "https://api.sandbox.freeagent.com", "accessToken" : "1YBpWH_SDwDUalF5Vv541uiW3zBIkjccmh817gRnV", "id" : "28437" }
Related FreeAgent documentation
https://dev.freeagent.com/docs/contacts#get-a-single-contact
Retrieving all contacts
The
operation retrieves all contacts.listContacts
<freeagent.listContacts> <view>{$ctx:view}</view> <sort>{$ctx:sort}</sort> </freeagent.listContacts>
Properties
The value for view filter.view:
The value for sort order.sort:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.listContacts
{ "apiUrl" : "https://api.sandbox.freeagent.com", "accessToken" : "1YBpWH_SDwDUalF5Vv541uiW3zBIkjccmh817gRnV", "view" : "all", "sort" : "name" }
Related FreeAgent documentation
https://dev.freeagent.com/docs/contacts#list-all-contacts
Sample configuration
Following is a sample proxy service that illustrates how to connect to FreeAgent with the init
operation and use the createContact operation. The sample request for this proxy can be found in the createContact sample request. You can use this sample as a template for using other operations in this category.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="freeagent_createContact" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="organisationName" expression="json-eval($.organisationName)"/> <property name="firstName" expression="json-eval($.firstName)"/> <property name="lastName" expression="json-eval($.lastName)"/> <property name="email" expression="json-eval($.email)"/> <property name="phoneNumber" expression="json-eval($.phoneNumber)"/> <property name="address1" expression="json-eval($.address1)"/> <property name="town" expression="json-eval($.town)"/> <property name="region" expression="json-eval($.region)"/> <property name="postcode" expression="json-eval($.postcode)"/> <property name="address2" expression="json-eval($.address2)"/> <property name="address3" expression="json-eval($.address3)"/> <property name="contactNameOnInvoices" expression="json-eval($.contactNameOnInvoices)"/> <property name="country" expression="json-eval($.country)"/> <property name="salesTaxRegistrationNumber" expression="json-eval($.salesTaxRegistrationNumber)"/> <property name="usesContactInvoiceSequence" expression="json-eval($.usesContactInvoiceSequence)"/> <freeagent.init> <accessToken>{$ctx:accessToken}</accessToken> <apiUrl>{$ctx:apiUrl}</apiUrl> </freeagent.init> <freeagent.createContact> <organisationName>{$ctx:organisationName}</organisationName> <firstName>{$ctx:firstName}</firstName> <lastName>{$ctx:lastName}</lastName> <email>{$ctx:email}</email> <phoneNumber>{$ctx:phoneNumber}</phoneNumber> <address1>{$ctx:address1}</address1> <town>{$ctx:town}</town> <region>{$ctx:region}</region> <postcode>{$ctx:postcode}</postcode> <address2>{$ctx:address2}</address2> <address3>{$ctx:address3}</address3> <contactNameOnInvoices>{$ctx:contactNameOnInvoices}</contactNameOnInvoices> <country>{$ctx:country}</country> <salesTaxRegistrationNumber>{$ctx:salesTaxRegistrationNumber}</salesTaxRegistrationNumber> <usesContactInvoiceSequence>{$ctx:usesContactInvoiceSequence}</usesContactInvoiceSequence> </freeagent.createContact> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>