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 Job Code Assignments in TSheets



Overview

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

For a sample proxy service that illustrates how to work with  job code assignments, see Sample configuration

OperationDescription

addJobCodeAssignments

Adding one or more job code assignments to a user.

listJobCodeAssignmentsRetrieves a list of all job code assignments.

Operation details

This section provides further details on the operations related to  job code assignments.

Adding a job code assignment to a user

The addJobCodeAssignments operation adds one or more job code assignments to a user. 

addJobCodeAssignments
<tsheets.addJobCodeAssignments>
	<jobCodeAssignments>{$ctx:jobCodeAssignments}</jobCodeAssignments>
</tsheets.addJobCodeAssignments>
Properties
  • jobCodeAssignments: Job code assignment details. JSON object or array.
Sample request

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

Sample Request for addJobCodeAssignments
{
	"apiUrl":"https://rest.tsheets.com",
	"accessToken":"S.1__730ab728db5db2f5a797363ce677ab3305f398da",
	"jobCodeAssignments":[
		{
	     	"user_id":"1920492",
	          "jobcode_id":"30676833"
         },
         {
	     	"user_id":"1920502",
	          "jobcode_id":"30676835"
         }
	]
}
Related TSheets documentation

http://developers.tsheets.com/docs/api/jobcode_assignments/add-jobcode-assignments

Retrieving a list of all job code assignments

The listJobCodeAssignments operation retrieves a list of all job code assignments associated with users.

listJobCodeAssignments
<tsheets.listJobCodeAssignments>
    <page>{$ctx:page}</page>
    <modifiedSince>{$ctx:modifiedSince}</modifiedSince>
    <modifiedBefore>{$ctx:modifiedBefore}</modifiedBefore>
    <userIds>{$ctx:userIds}</userIds>
    <active>{$ctx:active}</active>
    <perPage>{$ctx:perPage}</perPage>
    <jobcodeParentId>{$ctx:jobcodeParentId}</jobcodeParentId>
	<type>{$ctx:type}</type>
</tsheets.listJobCodeAssignments>
Properties
  • page: Integer. Represents the page of results to retrieve.
  • modifiedSince: String (ISO 8601 format). Only job code assignments modified since this date/time will be returned (i.e. 2004-02-12T15:19:21+00:00).
  • modifiedBefore: String (ISO 8601 format). Only job code assignments modified before this date/time will be returned (i.e. 2004-02-12T15:19:21+00:00).
  • userIds: Integer. Comma separated string of one or more user IDs.
  • active: String. yes, no, or both. Default is both. Yes means the assignment is active, no means it is deleted/inactive.
  • perPage: Integer. Represents how many results to retrieve per request (page). Default is 50. Max is 50.
  • jobcodeParentId: Integer. When omitted, all job code assignments are returned regardless of job code parent.
  • type: String. Refers to the jobcode type - regular, pto, or all. Defaults to regular.
Sample request

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

listJobCodeAssignments
{
	"apiUrl": "https://rest.tsheets.com",
	"accessToken": "S.1__730ab728db5db2f5a797363ce677ab3305f398da",
	"page":"1",
	"modifiedSince":"2015-02-26T12:04:21+00:00",
	"modifiedBefore":"2015-04-26T12:04:21+00:00",
	"userIds":"1920502",
	"active":"yes",
	"perPage":"5",
	"jobcodeParentId":"0",
	"type":"pto"
}
Related TSheets documentation

http://developers.tsheets.com/docs/api/jobcode_assignments/list-jobcode-assignments

Sample configuration

Following is a sample proxy service that illustrates how to connect to TSheets with the init operation and use the addJobCodeAssignments operation. The sample request for this proxy can be found in the addJobCodeAssignments 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="tsheets_addJobCodeAssignments" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
	 <target>
	 <inSequence onError="faultHandlerSeq">
      <property name="accessToken" expression="json-eval($.accessToken)"/>
      <property name="apiUrl" expression="json-eval($.apiUrl)"/>
      <property name="jobCodeAssignments" expression="json-eval($.jobCodeAssignments)"/>
      <tsheets.init>
         <accessToken>{$ctx:accessToken}</accessToken>
         <apiUrl>{$ctx:apiUrl}</apiUrl>
      </tsheets.init>
      <tsheets.addJobCodeAssignments>
         <jobCodeAssignments>{$ctx:jobCodeAssignments}</jobCodeAssignments>
      </tsheets.addJobCodeAssignments>
	   <respond/>
	 </inSequence>
	  <outSequence>
	   <send/>
	  </outSequence>
	 </target>
   <description/>
  </proxy>