Create Activity Dependency

POST /ws/rest/service/v2/activity/sheet/dependencies

Available: 24.10 and later

Purpose

Creates updates, and deletes activity dependencies for an activity in a specified activity sheet of a specified shell.

Note:

In the System Activity Sheet, the Dependency tab although visible, will be view-only.

Prerequisites

Ensure the following:

  • A shell has been created.
  • Activities in an activity sheet have been created.
  • You have Activity Sheet Services permissions under Activity Manager to use this REST service.

Request Format

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

{

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

"data":[]

}

Request Parameters - Options Map

Specify the following parameters:

Request Parameter Required? Data Type Description
project_number Yes String A valid 'Active' shell number.
source Yes String The source application or data from which dependency data is retrieved. Valid values include: "Primavera Cloud", "P6", and "Others".
activitySheetType Yes String

The type of activity sheet. Valid values include: "system" and "manual".

For Primavera Cloud and P6 integrations, specify "system", as the data should be inserted in the system activity sheet.

projectType No String

The type of project for which dependencies have to be created. Valid values include: "Current" (default), and "Baseline".

For Manual activity sheets, the value is ignored. For System activity sheets, defaults to "Current".

sourceProjectId No String

The project code in the source application. For example, Project code in Primavera Cloud.

For System activity sheets, it is the current project ID by default. For Manual activity sheet, it is the project number.

This field is mandatory if the source is P6 or Primavera Cloud, or the "activitySheetType" is "manual".

activitySheetName No String

The name of the activity sheet.

If "activitySheetType" is specified as "system", the value entered in this field is ignored.

If "activitySheetType" is specified as "manual", this field is mandatory. If a manual activity sheet with same name already exists, a dependency will be added/updated or removed for the activities in that activity sheet.

removeUnreferencedData No Boolean

Indicate whether to remove unreferenced data. Valid values include:

  • "true": Creates and updates dependencies specified in the request for the respective activities, and removes dependencies not existing in the current request data for the respective activities from the existing activity sheet.
  • "false" (default): Dependencies are not removed for an activity from the existing activity sheet. The REST service creates dependencies from the request data if they do not exist, and updates any existing dependencies.

By default, any dependency data for an activity not existing in the current request data will not be removed.

Request Parameters - Data [] List

Specify the following parameters in the data [] of the request:

Request Parameter Required? Data Type Description
succ_activityid Yes String The unique activity ID or activity code of the successive activity in the activity sheet.
pred_activityid Yes String The unique activity ID or activity code of the preceding activity in the activity sheet.
relation No String

The type of dependency between the tasks. Valid values include:

  • Finish-to-Start (default)
  • Finish-to-Finish
  • Start-to-Finish
  • Start-to-Start
lead/lag No Integer

For manual Activity sheet, the max lag value is calculated as:

max_lag_day = Math.floor(20000 / Number(hours_per_day)) - 1;

For system activity sheet, no limit validation is needed.

Default to 0 (zero).

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 an activity dependency, send a request in the following format:

{

"options": {

"project_number": "P-0040",

"source" : "Primavera Cloud",

"sourceProjectId" : "OPCProject",

"activitySheetType" : "system",

"activitySheetName" : "ActSheet1",

"projectType" : "Current",

"removeUnreferencedData" : false

},

"data": [

{

"succ_activityid": "A1010",

"pred_activityid": "A1020",

"relation":"Finish-to-Start",

"lag": 10

},

{

"succ_activityid": "A1030",

"pred_activityid": "A1040",

"relation":"Finish-to-Start",

"lag": 10

}

]

}

Sample Success Response

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

{

"data": [],

"message": [

{

"activitySheetName": "ManualSheet01",

"message" : "Job for dependencies data created successfully.",

"jobId" : 1688113665288

}

],

"status": 202,

"rest_audit_id": 28703

}

Sample Failed Request in Options Data

A failed response to create an activity dependency displays the corresponding status code in the following format:

{

"options": {

"project_number": "P-0040",

"source" : "ABC",

"sourceProjectId" : "OPCProject",

"activitySheetType" : "system",

"actSheetName" : "ActSheet1" ,

"projectType" : "Current",

"removeUnreferencedData" : false

},

"data": [

{

"succ_activityid": "A1010",

"pred_activityid": "A1020",

"relation":"Finish-to-Start",

"lag": 10

}

]

}

Sample Failed Response in Options Data

A failed response to create an activity dependency due to an error in the Options map displays the corresponding status code in the following format:

{

"data": [],

"message": [

"Invalid value was found in a field: [source]. Allowed values: [Primavera Cloud,P6, Others]"

],

"rest_audit_id": 2379,

"status": 12756

}

Sample Data Failure Request

A failed response to create an activity dependency displays the corresponding status code in the following format:

{

"options": {

"project_number": "P-0040",

"source" : "Primavera Cloud",

"sourceProjectId" : "OPCProject",

"activitySheetType" : "system",

"actSheetName" : "ActSheet1",

"projectType" : "Current",

"removeUnreferencedData" : false

},

"data": [

{

"succ_activityid": "A1010",

"pred_activityid": "A1020",

"relation":"ABC",

"lag": 10

},

{

"succ_activityid": "A1030",

"pred_activityid": "A1040",

"relation":"Finish-to-Start",

"lag": 10

}

]

}

Sample Failed Response in Data []

A failed response to create an activity dependency due to an error in the Data [] displays the corresponding status code in the following format:

{

"data": [],

"message": [

{

"activitySheetName": "ManualSheet01",

"message" : "Job for dependencies data created successfully.",

"jobId" : 1688113665288

}

],

"status": 202,

"rest_audit_id": 28703

}

Sample Failed Response

A failed response to create an activity dependency due to an invalid value displays the corresponding status code in the following format:

{

"data": [],

"message": [

{

"succ_activityid": "A1010",

"pred_activityid": "A1020",

"message": "Invalid value was found in a field: [relation]. Allowed only [Finish-to-Start, Finish-to-Finish, Start-to-Finish, Start-to-Start].",

"status": 12750

}

],

"status": 3000,

"rest_audit_id": 14302

}

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 specified. 12018 The API request is missing the required information: [project_number].
project_number project_number is invalid. 602 Project/Shell Number is not correct.
project_number project_number is inactive. 12020 The API request contains an invalid value: [project_number]. Please check the status of this project_number in Unifier.
project_number project_number is blank or empty 12128 The API request contains empty value for: [project_number].
source source is not specified in the request. 12007 The API request is missing the required information: [source]
source Wrong source value or value type for source, that is, boolean or numbers are specified. 12008 Invalid value was found in a field: [source]. Allowed values: [Primavera Cloud,P6, Others]
source source value is blank or empty. 12035 The API request contains empty value for: [source]. Allowed values: [Primavera Cloud, P6 Others]
activitySheetType activitySheetType value is missing. 12010 The API request is missing the required information: [activitySheetType]
activitySheetType activitySheetType value is invalid. 12011 Invalid value was found in a field: [activitySheetType]. Allowed values: [manual, system]
activitySheetType activitySheetType is "manual" when source is "Primavera Cloud" or "P6" in the request. 12671 Invalid value was found in a field: [activitySheetType]. If source=Primavera Cloud or P6, allowed values: [system]
activitySheetType activitySheetType is "system" when source is "Others" in the request. 12671 Invalid value was found in a field: [activitySheetType]. If source=Others, allowed values: [manual]
projectType projectType is missing in the request. 12143 The API request is missing the required information: [projectType].
projectType projectType is blank or empty. 12144 The API request contains empty value for: [projectType].
projectType projectType is the wrong data type(integer/boolean). 12142 Invalid value was found in a field: [projectType]. Allowed only alphanumeric value.
projectType Some invalid value except "Current"/"Baseline" passed in projectType. 12145 Invalid value was found in a field: [projectType]. Allowed values: [Current, Baseline]
sourceProjectId sourceProjectId is not configured in the source Unifier shell. 12021 The API request contains an invalid value: [sourceProjectId]. Please check if this sourceProjectId has been configured in Unifier.
sourceProjectId sourceProjectId has invalid special characters. 12022 The API request contains invalid characters in: [sourceProjectId]. The following characters are not allowed: / \\ : * ? \" < > | ' =
sourceProjectId sourceProjectId is missing. 12005 The API request is missing the required information: [sourceProjectId]
sourceProjectId sourceProjectId is blank. 12032 The API request contains empty value for: [sourceProjectId]
sourceProjectId sourceProjectId length is invalid. 12014 Invalid value was found in a field: 'sourceProjectId'. Allowed length: [250]
activitySheetName Activity sheet name is blank for an activity sheet type "manual". 12012 The API request is missing the required information: [activitySheetName].
activitySheetName ActivitySheetName does not exist. 12013 The API request contains an invalid value: [activitySheetName]. Please check if this activitySheetName with type=manual has been configured in Unifier.
removeUnreferencedData removeUnreferencedData is a non-boolean value. 12016 Invalid value was found in a field: [removeUnreferencedData]. Allowed values: [true, false]
succ_activityid succ_activityid is missing in the request. 12740 The API request is missing the required information: [succ_activityid]
succ_activityid succ_activityid is a non-string value. 12741 Invalid value was found in a field: [succ_activityid]. Allowed only string value or use quotations. Activity ID: <succ_activityid>
succ_activityid succ_activityid does not exist in the Activity Sheet. 12742 Invalid value was found in a field [succ_activityid]. Allowed Activity ID that already exists in Activity Sheet. Activity ID: <succ_activityid>
succ_activityid succ_activityid is blank. 12743 The API request contains an empty value for:[succ_activityid].
pred_activityid pred_activityid is missing in the request. 12744 The API request is missing the required information: [pred_activityid]
pred_activityid pred_activityid is a non-string value. 12745 Invalid value was found in a field: [pred_activityid]. Allowed only string value or use quotations. Activity ID: <pred_activityid>
pred_activityid pred_activityid does not exist in the Activity Sheet. 12746 Invalid value was found in a field [pred_activityid]. Allowed Activity ID that already exists in Activity Sheet. Activity ID: <pred_activityid>
pred_activityid pred_activityid is blank. 12747 The API request contains an empty value for: [pred_activityId].
relation Invalid dependency relation value has been specified in the request. 12748 Invalid value was found in a field: [relation]. Allowed only [Finish-to-Start, Finish-to-Finish, Start-to-Finish, Start-to-Start]
lead/lag A non-integer value is provided. 12749 Invalid value was found in a field: [lead]. Allowed only integer value
lead/lag Value exceeds the max_lag_day. 12750 Value entered exceeds maximum allowed lag of <max_lag_day>. Please check and try again