Creating Work Hours
Function
This API is used to create work hours.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v1/ipdprojectservice/projects/{project_id}/work-items/{workitem_id}/work-hour
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition 32-character ID of a project, which must be unique. Obtain the value by calling the API for querying the IPD project list. The value of id in the response message body is the project ID. Constraints N/A Range A string of 32 characters consisting of letters and digits. Default Value N/A |
| workitem_id | Yes | String | Work item ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| work_hour_category | No | String | Definition Work type. The value of the display_value field is displayed on the page, and the value of the value field is used as the input parameter of the API. Constraints N/A Range 0 to 512 characters. Obtain the value by calling the Querying Work Types API. Default Value N/A |
| work_date_begin | Yes | String | Definition Work start date. Constraints The start date cannot be later than the end date (work_date_end). Range Format: yyyy-MM-dd. Default Value N/A |
| work_date_end | Yes | String | Definition Work end date. Constraints The end date cannot be earlier than the start date (work_date_begin). Range Format: yyyy-MM-dd. Default Value N/A |
| work_hours | Yes | String | Definition Total workloads. Constraints The value must be a non-negative numeric string. When work_hour_type is set to 1, the value indicates the total number of person-days from the start date to the end date. When work_hour_type is set to 2, the value indicates the number of person-days per day. Range 0–100000 Default Value N/A |
| work_hour_type | Yes | String | Definition Workload calculation type, which defines the work_hours field. Constraints N/A Range
Default Value N/A |
| include_weekend | Yes | Boolean | Definition Whether to include weekends in workload calculation. Constraints N/A Range Default Value false |
| description | No | String | Definition Workload description. Constraints N/A Range 0 to 10,000 characters. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Response status. Range |
| message | String | Definition Response message. When the request fails, the failure cause is returned. Range 0 to 1,000 characters. |
| result | WorkHourTotalVO object | Definition List of workload information and total workloads. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| data | Array of WorkHourVO objects | Work hour information list. |
| work_hours_total | String | Total actual work hours. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Workload record ID. Range A string of 18 to 19 digits. |
| title | String | Definition Workload name. Range N/A |
| operation_id | String | Definition Operation ID, which identifies a specific operation record. Range N/A |
| description | String | Definition Description of the work content. Range Max. 10,000 characters. |
| workitem_id | String | Definition ID of the work item associated with the workload. You can obtain the value from the Querying Work Items or Querying Tree-shaped Work Items API. The value is id in the response body. Range A string of 18 to 19 digits. |
| work_date | String | Definition Timestamp of the work time, in milliseconds. Range N/A |
| created_by | UserEntity object | Definition Creator of the workload record. |
| modified_by | UserEntity object | Definition Information about the last person who modifies the workload record. |
| work_hour_category | String | Definition Work type. The value displayed on the page is display_value, and the unique ID is value. Range N/A |
| work_hours | Double | Definition Time spent (person-days). Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition User ID. Obtain it by calling the API for querying project members. The value of id in the response message body is the user ID. Range N/A |
| name | String | Definition Username. Range 2 to 64 characters. |
| nick_name | String | Definition User alias. Range 2 to 30 characters |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error description, which is a supplement to error_code. Range N/A |
Example Requests
100 person-days created from February 1 to 6, 2024; type: R&D design; weekends included
POST https://{endpoint}/v1/ipdprojectservice/projects/05c7d8bcf3db4829bc841e4ba93aaea5/work-items/976857692367659008/work-hour?_=1708329665577
{
"work_hour_category" : "R&D design",
"work_date_begin" : "2024/02/01",
"work_date_end" : "2024/02/02",
"work_hours" : "12",
"work_hour_type" : 1,
"include_weekend" : true,
"description" : "Work content"
} Example Responses
Status code: 200
{
"status" : "success",
"message" : null,
"result" : {
"data" : [ {
"work_date" : "1745337600000",
"modified_by" : "testuser",
"work_hour_category" : {
"id" : "1",
"display_value" : "Backend development",
"value" : "Backend development",
"value_py" : "hdkf",
"sequence" : 2,
"level" : 1,
"domain_id" : "1",
"created_by" : "testuser",
"created_date" : 1744750470000,
"modified_by" : "testuser",
"modified_date" : 1744750470000,
"belong_definition_type" : "5"
},
"description" : null,
"operation_id" : "1",
"id" : "1",
"work_hours" : 0.5,
"title" : null,
"created_by" : "testuser"
} ],
"work_hours_total" : 1
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response body for creating work hours. |
| 400 | Failure response body. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot