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 Companies in FreshDesk


Overview

The following operations allow you to work with companies. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with companies, see Sample configuration

OperationDescription

createCompany

Creates a new company.

getCompanyRetrieves a particular company.
listCompaniesRetrieves a list of companies.
updateCompanyUpdates a particular company.
deleteCompanyDeletes a particular company.
listCompanyFieldsList all fields of company.

Operation details

This section provides further details on the operations related to companies.

Creates a new company

The createCompany operation creates a new company.

createComapny
<freshdesk.createCompany>
    <name>{$ctx:name}</name>
    <description>{$ctx:description}</description>
    <domains>{$ctx:domains}</domains>
    <note>{$ctx:note}</note>
    <customFields>{$ctx:customFields}</customFields>
</freshdesk.createCompany>
Properties
  • name: Name of the Company.
  • description: Description of the Company.
  • note: Any specific note about the company.
  • customFields: Key value pairs containing the names and values of custom fields.
  • domains:Domains of the company.
  Sample request

Following is a sample REST/JSON request that can be handled by the createCompany operation.

Sample Request for createCompany
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2",
	"name":"companyName",
    "description":"Description of Company",
	"note":"companyNote",
	"domains":"["test1domain","test2domain"],
	"customFields": {
    	"a": "testa"
  	}
}

 

Retrieving a company

The  getCompany operation retrieves details of a specific company.

getCompany
<freshdesk.getCompany>
    <companyId>{$ctx:companyId}</companyId>
</freshdesk.getCompany>
Properties
  • companyId: The unique identifier of the Company.
   Sample request

Following is a sample REST/JSON request that can be handled by the  getCompany operation.

Sample Request for getCompany
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2",
	"companyId":"19000007803"
}

 

Retrieves a list of companies.

The listCompanies operation retrieves a list of companies.

listCompanies
<freshdesk.listCompanies/>
  Sample request

Following is a sample REST/JSON request that can be handled by the listCompanies operation.

Sample Request for listCompanies
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2"
}

 

Updates a particular company

The updateCompany operation updates a particular company.

updateComapny
<freshdesk.updateCompany>
    <companyId>{$ctx:companyId}</companyId>
    <name>{$ctx:name}</name>
    <description>{$ctx:description}</description>
    <domains>{$ctx:domains}</domains>
    <note>{$ctx:note}</note>
    <customFields>{$ctx:customFields}</customFields>
</freshdesk.updateCompany>
Properties
  • companyId: The unique identifier of a company.
  • name: Name of the Company.
  • description: Description of the Company.
  • note: Any specific note about the company.
  • customFields: Key value pairs containing the names and values of custom fields.
  • domains:Domains of the company.
  Sample request

Following is a sample REST/JSON request that can be handled by the updateCompany operation.

Sample Request for updateCompany
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2",
	"companyId":"19000007803",
    "name":"companyNameUpdates",
    "description":"Description of Company Update",
	"note":"companyNoteUpdate",
	"domains":"["test1domain","test2domain"],
	"customFields": {
    	"a": "testa"
  	}
}

 

Deletes a particular company

The deleteCompany operation deletes a particular company.

deleteComapny
<freshdesk.deleteCompany>
    <companyId>{$ctx:companyId}</companyId>
</freshdesk.deleteCompany>
Properties
  • companyId: The unique identifier of a company.
  Sample request

Following is a sample REST/JSON request that can be handled by the deleteCompany operation.

Sample Request for deleteCompany
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2",
    "companyId":"19000007803"

}

 

List all fields of company

The listCompanyFields operation lists all fields of company.

deleteComapny
<freshdesk.listCompanyFields/>

 

  Sample request

Following is a sample REST/JSON request that can be handled by the deleteCompany operation.

Sample Request for deleteCompany
{
	"apiUrl": "https://wso2yasho.freshdesk.com",
    "apiKey": "SODsQllHr0NicsiRpRWw",
	"apiVersion": "v2"
}

 

Sample configuration

Following is a sample proxy service that illustrates how to connect to FreshDesk with the init operation and use the createCompany operation. The sample request for this proxy can be found in the createCompany sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="freshdesk_createCompany"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="apiKey" expression="json-eval($.apiKey)"/>
         <property name="apiVersion" expression="json-eval($.apiVersion)"/>
		 <property name="name" expression="json-eval($.name)"/>
         <property name="description" expression="json-eval($.description)"/>
         <property name="domains" expression="json-eval($.domains)"/>
		 <property name="note" expression="json-eval($.note)"/>
		 <property name="customFields" expression="json-eval($.customFields)"/>
 		 <freshdesk.init>
            <apiKey>{$ctx:apiKey}</apiKey>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiVersion>{$ctx:apiVersion}</apiVersion>
		 </freshdesk.init>
         <freshdesk.createCompany>
    		<name>{$ctx:name}</name>
    		<description>{$ctx:description}</description>
    		<domains>{$ctx:domains}</domains>
    		<note>{$ctx:note}</note>
    		<customFields>{$ctx:customFields}</customFields>
		 </freshdesk.createCompany>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>