Creating a Time Sheet

Request: http://<PPM_Server_IP>:<port>/itg/rest/tm/timeSheets

HTTP Method: POST

Description: Create a time sheet.

Request entity body: The body of this operation needs t include an XML object with the following format:

<TimeSheet>
  <periodId>100099</periodId> 
  <resourceId>1</resourceId> 
  <sequence>1</sequence> 
  <status>1</status> 
  <description>User, Admin - 13-5-1 - 13-5-15 - sample for document 
  </description> 
  <policies>
    <policy>
      <name>AllowMultipleTimeSheets</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>MaximumHoursPerDay</name> 
      <value /> 
    </policy>
    <policy>
      <name>BucketShowLevel</name> 
      <value>DAY</value> 
    </policy>
    <policy>
      <name>BucketReportMethod</name> 
      <value>HOURS</value> 
    </policy>
    <policy>
      <name>HoursInPeriodType</name> 
      <value>WORKDAY</value> 
    </policy>
    <policy>
      <name>HoursInPeriod</name> 
      <value>0.0</value> 
    </policy>
    <policy>
      <name>NotifyDelinquentTimeSheet</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>MaximumHoursPerDay</name> 
      <value /> 
    </policy>
    <policy>
      <name>MaximumHoursPerTimeSheet</name> 
      <value /> 
    </policy>
    <policy>
      <name>MinimumHoursPerTimeSheet</name> 
      <value /> 
    </policy>
    <policy>
      <name>MaximumPercentPerTimeSheet</name> 
      <value /> 
    </policy>
    <policy>
      <name>MinimumPercentPerTimeSheet</name> 
      <value /> 
    </policy>
    <policy>
      <name>EnforcementLevelError</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>PeriodHoursCalcTypeCode</name> 
      <value /> 
    </policy>
    <policy>
      <name>WorkdayHours</name> 
      <value /> 
    </policy>
    <policy>
      <name>ReqActivitiesRequiredFlag</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>TskActivitiesRequiredFlag</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>PrjActivitiesRequiredFlag</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>PkgActivitiesRequiredFlag</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>MiscActivitiesRequiredFlag</name> 
      <value>false</value> 
    </policy>
    <policy>
      <name>ReqWorkItemEnabledFlag</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>TskWorkItemEnabledFlag</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>PrjWorkItemEnabledFlag</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>PkgWorkItemEnabledFlag</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>MscWorkItemEnabledFlag</name> 
      <value>true</value> 
    </policy>
    <policy>
      <name>AllowEmptyLineFlag</name> 
      <value>1</value> 
    </policy>
  </policies>
  <notes>
    <note>
      <id>159842</id> 
      <description>document sample - time sheet notes sample for the document
      </description> 
      <type>TS</type> 
    </note>
  </notes>
  <timeSheetLines>
    <workItemId>3282935</workItemId> 
    <workItemType>PROJECT</workItemType> 
    <actuals>
      <actual>
        <activityId>30067</activityId> 
        <efforts>
          <dayNum>10</dayNum> 
          <effort>4.0</effort> 
        </efforts>
        <efforts>
          <dayNum>15</dayNum> 
          <effort>6.0</effort> 
        </efforts>
        <activityType>added</activityType> 
      </actual> 
      <actual>
        <activityId>30076</activityId> 
        <efforts>
          <dayNum>7</dayNum> 
          <effort>10.0</effort> 
        </efforts>
        <activityType>added</activityType> 
      </actual>
      <actual>
        <activityId>30131</activityId> 
        <activityType>added</activityType> 
      </actual>
      <actualsType>activity</actualsType> 
    </actuals>
    <chargeCodes>
      <updateChargeCodeFlag>true</updateChargeCodeFlag> 
      <requireChargeCodeFlag>false</requireChargeCodeFlag> 
      <tslChargeCodes>
       <chargePercent>0.0</chargePercent> 
       <chargeCode>
         <id>100002</id> 
       </chargeCode>
     </tslChargeCodes>
     <tslChargeCodes>
       <chargePercent>10.0</chargePercent> 
       <chargeCode>
         <id>100003</id> 
         </chargeCode>
     </tslChargeCodes>
     <tslChargeCodes>
       <chargePercent>90.0</chargePercent> 
       <chargeCode>
         <id>100001</id> 
       </chargeCode>
     </tslChargeCodes>
   </chargeCodes>
   <workItemSetId>60000</workItemSetId> 
   <notes>
     <note>
       <id>159841</id> 
       <description>time sheet restful notes sample. it is used for sample only - update12334</description> 
       <type>TSL</type> 
     </note>
   </notes>
  </timeSheetLines>
  <timeSheetLines>
     <workItemId>217037</workItemId> 
     <workItemType>TASK</workItemType> 
     <status>1</status> 
     <actuals>
       <actual>
         <efforts>
           <dayNum>7</dayNum> 
           <effort>9.0</effort> 
         </efforts>
         <efforts>
           <dayNum>10</dayNum> 
           <effort>7.0</effort> 
         </efforts>
         <efforts>
           <dayNum>15</dayNum> 
           <effort>8.0</effort> 
         </efforts>
       </actual>
       <actualsType>common</actualsType> 
     </actuals>
   <workUnit>
     <percentComplete>80</percentComplete> 
   </workUnit>
   <chargeCodes>
     <updateChargeCodeFlag>true</updateChargeCodeFlag> 
     <requireChargeCodeFlag>false</requireChargeCodeFlag> 
     <tslChargeCodes>
       <chargePercent>0.0</chargePercent> 
       <chargeCode>
         <id>100002</id> 
       </chargeCode>
     </tslChargeCodes>
     <tslChargeCodes>
       <chargePercent>0.0</chargePercent> 
       <chargeCode>
         <id>100003</id> 
       </chargeCode>
     </tslChargeCodes>
     <tslChargeCodes>
       <chargePercent>100.0</chargePercent> 
       <chargeCode>
         <id>100001</id> 
       </chargeCode>
     </tslChargeCodes>
   </chargeCodes>
   <workItemSetId>31600</workItemSetId> 
   <notes /> 
  </timeSheetLines>
</TimeSheet>

Response Entity body:

  • on success: Return an XML object of the created time sheet with the following format:

    <ns2:createTimeSheetResponse>
       <timeSheetId>30291</timeSheetId>
       <timeSheetLineIds>30527</timeSheetLineIds>
    </ns2:createTimeSheetResponse>
  • on failure: The following message codes are returned if the operation fails:

    Message Code

    HTTP Return Code

    Message

    Cause

    Possible Corrective Action

    PPMC_WSE006

    403

    The user does not have the access grant to perform this action.

    The user does not have the required access grant.

    Get the access grant.

    PPMC_WSE007

    403

    The user does not have access to this resource.

    The user has no access to this resource.

    N/A

    PPMC_WSE513

    400

    Field {0} cannot be null or empty.

    Field {0} is or empty.

    Fill the field with a value.

    PPMC_WSE514

    400

    Field {0} should be greater than {1}.

    Field {0} is less than {1}.

    Correct the field value.

    PPMC_WSE515

    400

    Field {0} should be greater than or equal to {1}.

    Field {0} is less than {1}.

    Correct the field value.

    PPMC_WSE516

    400

    Field {0} should be less than {1}.

    Field {0} is not less than {1}

    Correct the field value.

    PPMC_WSE517

    400

    Field {0} should be less than or equal to {1}.

    Field {0} is greater than {1}.

    Correct the field value.

    PPMC_WSE518

    400

    Field {0} should be greater than {1} and less than {2}.

    Field {0} is not greater than {1} and less than {2}

    Correct the field value.

    PPMC_WSE519

    400

    Field {0} should be greater than or equal to {1} and less than or equal to {2}.

    Field {0} is not greater than or equal to {1} and less than or equal to {2}.

    Correct the field value.

    PPMC_WSE520

    400

    The status can only be UNSUBMITTED when a time sheet is created.

    The status is not UNSUBMITTED when a time sheet is created.

    Correct the field value.

    PPMC_WSE521

    400

    Fail to pass business restriction.

    Fail to pass business restriction.

    N/A

    PPMC_WSE522

    500

    Time Management service internal error.

    There was an internal error when you executed this operation.

    N/A

    PPMC_WSE523

    400

    Total actual effort cannot be less than 0.

    Total actual effort is less than 0.

    Correct the total actual effort.

    PPMC_WSE524

    400

    The day number exceeds the time period duration, and the day number {0} cannot be greater than {1}.

    The day number exceeds the time period duration, and the day number {0} is greater than {1}.

    Correct the day number.

    PPMC_WSE525

    400

    Work item type must be one of the following types: [TASK, PROJECT, REQUEST, PACKAGE, MISC].

    Work item type is undefined.

    Choose the work item type from the [TASK, PROJECT, REQUEST, PACKAGE, MISC] list.

    PPMC_WSE526

    400

    The work item [{0}:{1}] is invalid for resource {2} and time period {3}.

    The work item [{0}:{1}] is invalid for resource {2} and time period {3}.

    Choose a valid work item for resource {2} and time period {3}.