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 Tasks in FreeAgent



Overview

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

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

OperationDescription

createTask

Creates a new task.

getTaskByIdRetrieves a single task by ID.
listTasksRetrieves all tasks.

Operation details

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

Creating a new task

The createTask operation creates a new task.

createTask
<freeagent.createTask>
	<project>{$ctx:project}</project>
    <billingPeriod>{$ctx:billingPeriod}</billingPeriod>
    <status>{$ctx:status}</status>
    <isBillable>{$ctx:isBillable}</isBillable>
    <name>{$ctx:name}</name>
    <billingRate>{$ctx:billingRate}</billingRate>
</freeagent.createTask>
Properties
  • project: The project to which the task belongs.
  • billingPeriod: The billing period of the task.
  • status: The status of the task.
  • isBillable: Whether the task is billable.
  • name: The name of the task.
  • billingRate: The billing rate of the task.
Sample request

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

Sample Request for createTask
{
	"accessToken":"1S1Sd_eb-pE0hjMJnWrYmj4vfi496Gf0YyRhzzgRE",
	"apiUrl":"https://api.sandbox.freeagent.com",
	"project":"2731",
	"name":"UpdateInventory",
	"billingPeriod":"hour",
	"status":"active",
	"isBillable":"true",
	"billingRate":"12.0"
}
Related FreeAgent documentation

https://dev.freeagent.com/docs/tasks#create-a-task-under-a-certain-project

Retrieving a single task by ID

The getTaskById operation retrieves a single task by ID.

getTaskById
<freeagent.getTaskById>
	<id>{$ctx:id}</id>
</freeagent.getTaskById>
Properties
  • id: The ID of the task.
Sample request

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

getTaskById
{
	"accessToken":"1S1Sd_eb-pE0hjMJnWrYmj4vfi496Gf0YyRhzzgRE",
	"apiUrl":"https://api.sandbox.freeagent.com",
	"id":"315"
}
Related FreeAgent documentation

https://dev.freeagent.com/docs/tasks#get-a-single-task

Retrieving all tasks

The listTasks operation retrieves all tasks.

listTasks
<freeagent.listTasks>
	<project>{$ctx:project}</project>
</freeagent.listTasks>
Properties
  • project: The ID of the project for which tasks will be retrieved.
Sample request

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

listTasks
{
	"accessToken":"1S1Sd_eb-pE0hjMJnWrYmj4vfi496Gf0YyRhzzgRE",
	"apiUrl":"https://api.sandbox.freeagent.com",
	"project":"2731"
}
Related FreeAgent documentation

https://dev.freeagent.com/docs/tasks#list-all-tasks-under-a-certain-project

Sample configuration

Following is a sample proxy service that illustrates how to connect to FreeAgent with the init operation and use the createTask operation. The sample request for this proxy can be found in the createTask sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
	<proxy xmlns="http://ws.apache.org/ns/synapse" name="freeagent_createTask" 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="project" expression="json-eval($.project)"/>
      <property name="billingPeriod" expression="json-eval($.billingPeriod)"/>
      <property name="status" expression="json-eval($.status)"/>
      <property name="isBillable" expression="json-eval($.isBillable)"/>
      <property name="name" expression="json-eval($.name)"/>
      <property name="billingRate" expression="json-eval($.billingRate)"/>
      <freeagent.init>
         <accessToken>{$ctx:accessToken}</accessToken>
         <apiUrl>{$ctx:apiUrl}</apiUrl>
      </freeagent.init>
      <freeagent.createTask>
         <project>{$ctx:project}</project>
         <billingPeriod>{$ctx:billingPeriod}</billingPeriod>
         <status>{$ctx:status}</status>
         <isBillable>{$ctx:isBillable}</isBillable>
         <name>{$ctx:name}</name>
         <billingRate>{$ctx:billingRate}</billingRate>
      </freeagent.createTask>
	   <respond/>
	 </inSequence>
	  <outSequence>
	   <send/>
	  </outSequence>
	 </target>
   <description/>
  </proxy>