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 Time Entries in FreshBooks
Overview
The following operations allow you to work with time entries. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with time entries, see Sample configuration.
Operation | Description |
---|---|
Creates a new timesheet entry. | |
getTimeEntry | Retrieves a single time entry record. |
listTimeEntries | Retrieves a list of timesheet entries. |
updateTimeEntry | Updates an existing time entry. |
Operation details
This section provides details on the time entries.
Creating a new timesheet entry
The createTimeEntry
operation creates a new timesheet entry.
<freshbooks.createTimeEntry> <projectId>{$ctx:projectId}</projectId> <taskId>{$ctx:taskId}</taskId> <staffId>{$ctx:staffId}</staffId> <hours>{$ctx:hours}</hours> <notes>{$ctx:notes}</notes> <date>{$ctx:date}</date> </freshbooks.createTimeEntry>
Properties
projectId:
The project ID of the time entry.taskId:
The task ID of the time entry.staffId:
The staff ID of the time entry.hours:
The number of hours of the time entry.notes:
The additional notes.date:
Effective date of time entry
Sample request
Following is a sample REST/XML request that can be handled by the createTimeEntry
operation.
<createTimeEntry> <arbitraryPassword></arbitraryPassword> <apiUrl>https://supun.freshbooks.com</apiUrl> <authenticationToken>a0491134a07f92b7570a4790e4c88798</authenticationToken> <projectId>20137</projectId> <taskId>215714</taskId> <staffId>1</staffId> <hours>1</hours> <notes>test</notes> <date>2015-04-20</date> </createTimeEntry>
Related FreshBooks documentation
http://www.freshbooks.com/developers/docs/time-entries#time_entry.create
Retrieving a single time entry record
The getTimeEntry operation retrieves a single time entry record.
<freshbooks.getTimeEntry> <timeEntryId>{$ctx:timeEntryId}</timeEntryId> </freshbooks.getTimeEntry>
Properties
timeEntryId:
The ID of a time entry.
Sample request
Following is a sample REST/XML request that can be handled by the getTimeEntry operation.
<getTimeEntry> <arbitraryPassword></arbitraryPassword> <apiUrl>https://supun.freshbooks.com</apiUrl> <authenticationToken>a0491134a07f92b7570a4790e4c88798</authenticationToken> <timeEntryId>43966</timeEntryId> </getTimeEntry>
Related FreshBooks documentation
http://www.freshbooks.com/developers/docs/time-entries#time_entry.get
Retrieving a list of timesheet entries
The listTimeEntries
operation retrieves a list of timesheet entries.
<freshbooks.listTimeEntries> <page>{$ctx:page}</page> <perPage>{$ctx:perPage}</perPage> <projectId>{$ctx:projectId}</projectId> <taskId>{$ctx:taskId}</taskId> <dateFrom>{$ctx:dateFrom}</dateFrom> <dateTo>{$ctx:dateTo}</dateTo> </freshbooks.listTimeEntries>
Properties
page:
The number of the page.perPage:
The number of results per page.projectId:
The unique identifier of the project by which the results can be filtered.taskId:
The unique identifier of the task by which the results can be filtered.dateFrom:
The 'from date' of the task by which the results can be filtered.dateTo:
The 'to date' of the task by which the results can be filtered.
Sample request
Following is a sample REST/XML request that can be handled by the listTimeEntries operation.
<listTimeEntries> <arbitraryPassword></arbitraryPassword> <apiUrl>https://supun.freshbooks.com</apiUrl> <authenticationToken>a0491134a07f92b7570a4790e4c88798</authenticationToken> <page>1</page> <perPage>5</perPage> <projectId>20137</projectId> <taskId>215714</taskId> <dateFrom>2015-04-19</dateFrom> <dateTo>2015-04-21</dateTo> </listTimeEntries>
Related FreshBooks documentation
http://www.freshbooks.com/developers/docs/time-entries#time_entry.list
Updating an existing time entry
The updateTimeEntry
operation updates an existing time entry.
<freshbooks.updateTimeEntry> <timeEntryId>{$ctx:timeEntryId}</timeEntryId> <projectId>{$ctx:projectId}</projectId> <taskId>{$ctx:taskId}</taskId> <staffId>{$ctx:staffId}</staffId> <hours>{$ctx:hours}</hours> <notes>{$ctx:notes}</notes> <date>{$ctx:date}</date> </freshbooks.updateTimeEntry>
Properties
timeEntryId:
The ID of a time entry.projectId:
The project ID of the time entry.taskId:
The task ID of the time entry.staffId:
The staff ID of the time entry.hours:
The number of hours of the time entry.notes:
The additional notes.date:
Effective date of the time entry.
Sample request
Following is a sample REST/XML request that can be handled by the updateTimeEntry
operation.
<updateTimeEntry> <arbitraryPassword></arbitraryPassword> <apiUrl>https://supun.freshbooks.com <https://supun.freshbooks.com/> </apiUrl> <authenticationToken>a0491134a07f92b7570a4790e4c88798</authenticationToken> <timeEntryId>94828</timeEntryId> <projectId>20137</projectId> <taskId>215714</taskId> <staffId>1</staffId> <hours>3</hours> <notes>sample</notes> <date>2015-04-21</date> </updateTimeEntry>
Related FreshBooks documentation
http://www.freshbooks.com/developers/docs/time-entries#time_entry.update
Sample configuration
Following is a sample proxy service that illustrates how to connect to FreshBooks with the init
operation and use the createTimeEntry operation. The sample request for this proxy can be found in createTimeEntry 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="freshbooks_createTimeEntry" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="arbitraryPassword" expression="//arbitraryPassword/text()"/> <property name="apiUrl" expression="//apiUrl/text()"/> <property name="authenticationToken" expression="//authenticationToken/text()"/> <property name="projectId" expression="//projectId/text()"/> <property name="taskId" expression="//taskId/text()"/> <property name="staffId" expression="//staffId/text()"/> <property name="hours" expression="//hours/text()"/> <property name="notes" expression="//notes/text()"/> <property name="date" expression="//date/text()"/> <freshbooks.init> <arbitraryPassword>{$ctx:arbitraryPassword}</arbitraryPassword> <apiUrl>{$ctx:apiUrl}</apiUrl> <authenticationToken>{$ctx:authenticationToken}</authenticationToken> </freshbooks.init> <freshbooks.createTimeEntry> <projectId>{$ctx:projectId}</projectId> <taskId>{$ctx:taskId}</taskId> <staffId>{$ctx:staffId}</staffId> <hours>{$ctx:hours}</hours> <notes>{$ctx:notes}</notes> <date>{$ctx:date}</date> </freshbooks.createTimeEntry> <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]"> <then> <switch source="$axis2:HTTP_SC"> <case regex="400"> <property name="ERROR_CODE" value="600400"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </case> <case regex="401"> <property name="ERROR_CODE" value="600401"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </case> <case regex="404"> <property name="ERROR_CODE" value="600404"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </case> <case regex="403"> <property name="ERROR_CODE" value="600403"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </case> <case regex="500"> <property name="ERROR_CODE" value="600500"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </case> <default> <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/> <property name="ERROR_MESSAGE" expression="//*[local-name()='error']"/> </default> </switch> <sequence key="faultHandlerSeq"/> </then> </filter> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>