Create Work Package

POST /ws/rest/service/v2/projectcostsheet/workpackage

Purpose

Create one or more work packages per project.

Prerequisites

Ensure you have Full Access or Create permissions for CBS services.

Request Format

Send an API request as a JSON map with the following structure:

{

"options":{"project_number": "<value>"},

"data":[ {

"name":"<value>",

"ref_no" : "<value>",

"status": "<boolean value>",

"description" : "<value>",

"owner" : "<full name>",

"vendor" :"<vendor company name>",

"comments" : "<comments text>"}

}

]

}

Request Parameters

Specify the following parameters:

Request Parameter Required? Data Type Description
project_number Yes String A valid 'Active' shell number.
name Yes String A unique alphanumeric name for a work package, with a maximum of 100 characters.
ref_no Yes String A unique reference number, with a maximum of 100 characters.
status Yes String The status of the project. Valid values include: "Active" and "Inactive".
description No String A description of the work package with a maximum of 3950 characters.
owner No String The full name of the user with an Active status.
vendor No String The name of the sponsor and member company of the shell.
comments No String Comments with a maximum of 3950 characters.

Response Format

A JSON object is returned in the following format:

{

"data": [],

"message": [<list of messages>],

"status": <REST status code value>,

"rest_audit_id": <id from the audit table>

}

A successful response displays a status code 200.

A failed response displays a message with a status code.

Sample Success Request

To create a work package, send a request in the following format:

{

"options": {

"project_number" : "P-0021"

},

"data": [

{

"status": "Active",

"name": "A87",

"ref_no" : "A87",

"owner": "Company Administrator",

"vendor" : "IDC Company",

"comments" : "comments",

"description": "description"

}

]

}

Sample Success Response

A successful response with status code 200 displays in the following format:

{

"data": [

{

"owner": "Company Administrator",

"comments": "comments",

"_record_status": "success",

"vendor": "IDC Company",

"name": "B11",

"description": "description",

"ref_no": "B11",

"status": "Active"

}

],

"message": [],

"status": 200,

"rest_audit_id": 4039

}

Sample Failed Response

A failed response to create a work package displays the corresponding status code in the following format:

{

"data": [],

"message": [

"Create/Update/Delete cannot be performed when project/shell status is Inactive or View-Only or On-Hold."

],

"status": 1245,

"rest_audit_id": 3347

}

Sample Failed Response - Multiple Records

A failed response to create a work package displays the corresponding status code in the following format:

{

"data": [],

"message": [

{

"owner": "Company Administrator",

"comments": "comments",

"_record_status": "Provide a valid status value - Active or Inactive",

"vendor": "IDC Company",

"name": "A87",

"description": "description",

"ref_no": "A87",

"status": "1"

},

{

"owner": "Company Administrator",

"comments": "comments",

"_record_status": "Work package name is already used.",

"vendor": "IDC Company",

"name": "A85",

"description": "description",

"ref_no": "A85",

"status": "Active"

}

],

"status": 3000,

"rest_audit_id": 3191

}

Supported Validation Messages and Status Codes

The following validation messages and status codes display in the response when incorrect values are provided in the request.

Field Name Use-case Scenario Status Code Error Message
project_number Project_number is not included in the request. 13001 Project/Shell number is mandatory and is missing in the input request
project_number Project number is invalid. 602 Project/Shell Number is not correct.
project_number Project/Shell is not active. 1245 Create/Update/Delete cannot be performed when project/shell status is Inactive or View-Only or On-Hold.
project_number Cost sheet does not exist in the specified shell. 707 Cost sheet does not exist
name Duplicate work package name. 1805 Work package name is already used.
name Work package name is not included in the request. 1809 Provide a work package name
name Work Package name exceeds 100 characters. 1812 Work package name cannot have more than 100 characters
ref_no Duplicate ref_no. 1806 Work Package Reference No. already exists.
ref_no ref_no is not included in the request. 1810 Work Package Reference No. is required field
ref_no ref_no exceeds 100 characters. 1813 Work Package Reference No. cannot have more than 100 characters
status Status is not provided or incorrect status is provided. 1811 Provide a valid status value - Active or Inactive
vendor vendor is inactive. 1807 Vendor provided is not an active member company or sponsor company name.
owner Owner is inactive. 1808 Owner provided is not an active user in Shell
comments Comments exceeds 3950 characters. 1813 Comments cannot have more than 3950 characters
description Description exceeds 3950 characters. 1814 Description cannot have more than 3950 characters
All fields Any other exception 1815 Exception encountered during processing