Create or Update Assignment Spreads

POST /ws/rest/service/v2/activity/sheets/assignments/spread

Purpose

Creates or updates Assignment Spreads in a specific shell from the source system.

Note:

The POST method captures both create and update actions. Therefore, selecting or clearing Update permissions has no impact on this REST Service.

Prerequisites

You must have Create permissions enabled.

This REST service is specific to updating externally synced Assignment Spread data from other applications. Therefore, sourceProjectID should be configured or added in the user interface tab (go to the applicable project/shell tab, select My Dashboard, select Details, and select the Integration tab).

Request Format

Send an API request in the following format:

{

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

"data":[]

}

In "data", value is accepted in form-data

key : file

value : {filename}.zip

Request Parameters - Form Data Fields

Specify the following parameters in the form data:

Request Parameter Required? Data Type Description
_attachment Yes

A JSON object in the following format:

{

"zipped_file_name": "filname.zip",

"zipped_file_size": Integer,

"zipped_file_content":""

}

The file name uploaded by the REST service.
options Yes

An Options JSON object in the following format:

{

"project_number" : <value>,

"sourceProjectId":<value>,

"source": "<value>"

}

JSON input containing source and project-related information.

Request Parameters

Specify the following parameters in the Options object:

Request Parameter Required? Data Type Description
source Yes String External application or data from which Activity Spread data are pulled. Valid value includes: "Primavera Cloud", and "P6".
project_number Yes String A valid 'Active' shell number where the spread data will be pushed.
sourceProjectId Yes String The Primavera Cloud or P6 project code.
projectType Yes String The type of project in Unifier for which the Assignments have to be created. Valid values include: "Current" and "Baseline".

Request Parameters - _attachment JSON Object

Specify the following parameters in the _attachment JSON Object:

equest Parameter Required? Data Type Description
zipped_file_name Yes String The file name uploaded by the REST service.
zipped_file_content Yes String A Base64 encoded zip file.
zipped_file_size No Integer The file size of the zipped file uploaded by the REST service.

Mandatory Fields for Baseline and Current projectType

Specify the following fields in the zipped_file_content for a "Baseline" or "Current" Projecttype:

{"resourceAssignments","activityCode","resourceCode","timescale","spread",

"actualCost","actualUnits","plannedCost","plannedUnits","remainingUnits",

"remainingCost","atCompletionCost","atCompletionUnits",

"actualCostProject","atCompletionCostProject","plannedCostProject","remainingCostProject",

"spreadDates" }

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 Spread JSON Format

{

"project": {

"baselineId": 182202,

"baselineName": "B3",

"isBaseline": true,

"projectCode": "AOPC",

"projectId": 310301,

"projectName": "AOPC"

},

"resourceAssignments": [

{

"activityCode": "A11",

"activityId": 246001,

"activityName": "Act1",

"actualCost": 0,

"actualCostProject": 0,

"actualUnits": 0,

"assignmentCode": "AA0",

"assignmentId": 100001,

"atCompletionCost": 0,

"atCompletionCostProject": 0,

"atCompletionUnits": 40,

"plannedCost": 0,

"plannedCostProject": 0,

"plannedUnits": 40,

"rateSource": "RESOURCE",

"remainingCost": 0,

"remainingCostProject": 0,

"remainingUnits": 40,

"resourceCode": "R19",

"resourceId": 56101,

"resourceName": "R1",

"spread": {

"actualCost": [

0,

0,

0,

0,

0,

0,

0

],

"actualCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"actualUnits": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCost": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionUnits": [

8,

0,

0,

8,

8,

8,

8

],

"plannedCost": [

0,

0,

0,

0,

0,

0,

0

],

"plannedCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"plannedUnits": [

8,

0,

0,

8,

8,

8,

8

],

"remainingCost": [

0,

0,

0,

0,

0,

0,

0

],

"remainingCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"remainingUnits": [

8,

0,

0,

8,

8,

8,

8

],

"spreadDates": [

"2023-06-09T00:00:00",

"2023-06-10T00:00:00",

"2023-06-11T00:00:00",

"2023-06-12T00:00:00",

"2023-06-13T00:00:00",

"2023-06-14T00:00:00",

"2023-06-15T00:00:00"

]

}

},

{

"activityCode": "A22",

"activityId": 246002,

"activityName": "Act2",

"actualCost": 0,

"actualCostProject": 0,

"actualUnits": 0,

"assignmentCode": "AA1",

"assignmentId": 100002,

"atCompletionCost": 0,

"atCompletionCostProject": 0,

"atCompletionUnits": 40,

"plannedCost": 0,

"plannedCostProject": 0,

"plannedUnits": 40,

"rateSource": "RESOURCE",

"remainingCost": 0,

"remainingCostProject": 0,

"remainingUnits": 40,

"resourceCode": "R20",

"resourceId": 56201,

"resourceName": "R2",

"spread": {

"actualCost": [

0,

0,

0,

0,

0,

0,

0

],

"actualCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"actualUnits": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCost": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionUnits": [

8,

0,

0,

8,

8,

8,

8

],

"plannedCost": [

0,

0,

0,

0,

0,

0,

0

],

"plannedCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"plannedUnits": [

8,

0,

0,

8,

8,

8,

8

],

"remainingCost": [

0,

0,

0,

0,

0,

0,

0

],

"remainingCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"remainingUnits": [

8,

0,

0,

8,

8,

8,

8

],

"spreadDates": [

"2023-06-09T00:00:00",

"2023-06-10T00:00:00",

"2023-06-11T00:00:00",

"2023-06-12T00:00:00",

"2023-06-13T00:00:00",

"2023-06-14T00:00:00",

"2023-06-15T00:00:00"

]

}

},

{

"activityCode": "A33",

"activityId": 246003,

"activityName": "Act3",

"actualCost": 0,

"actualCostProject": 0,

"actualUnits": 0,

"assignmentCode": "AA2",

"assignmentId": 100003,

"atCompletionCost": 0,

"atCompletionCostProject": 0,

"atCompletionUnits": 40,

"plannedCost": 0,

"plannedCostProject": 0,

"plannedUnits": 40,

"rateSource": "RESOURCE",

"remainingCost": 0,

"remainingCostProject": 0,

"remainingUnits": 40,

"resourceCode": "R21",

"resourceId": 56202,

"resourceName": "R3",

"spread": {

"actualCost": [

0,

0,

0,

0,

0,

0,

0

],

"actualCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"actualUnits": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCost": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"atCompletionUnits": [

8,

0,

0,

8,

8,

8,

8

],

"plannedCost": [

0,

0,

0,

0,

0,

0,

0

],

"plannedCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"plannedUnits": [

8,

0,

0,

8,

8,

8,

8

],

"remainingCost": [

0,

0,

0,

0,

0,

0,

0

],

"remainingCostProject": [

0,

0,

0,

0,

0,

0,

0

],

"remainingUnits": [

8,

0,

0,

8,

8,

8,

8

],

"spreadDates": [

"2023-06-09T00:00:00",

"2023-06-10T00:00:00",

"2023-06-11T00:00:00",

"2023-06-12T00:00:00",

"2023-06-13T00:00:00",

"2023-06-14T00:00:00",

"2023-06-15T00:00:00"

]

}

}

],

"timescale": "daily"

}

Sample Success Request

{hosturl}/ws/rest/service/v2/activity/sheets/assignments/spread

Inputs in JSON Raw-Data

{

"options": {

"project_number": "P-0056",

"sourceProjectId": "P-0056",

"source": "Primavera Cloud",

"projectType": "Current"

},

"_attachment": {

"zipped_file_name": "AssignmentSpread.zip",

"zipped_file_size": 780,

"zipped_file_content": "UEsDBBQAAAAIAKuD7VYD1rN9XAIAAI8fAAAVAAAAQXNzaWdubWVudFNwcmVhZC5qc29u7Zhda9swFIbvB/sPQdcp6CMNSe/SrBeDbSnpejV2odkiaNhysJRBGfnvkxVbcmzP6soam6IQiO33yOe1zpH1kN/v300mYJ9nP1mkwM3EnOsrP6hkCRfsY6wvogXGEE8b0heaMi2CWwIqicvbk1gIKj8wI7gE6yw2Q1ab+zVoaCYTQZBA1FB0IjeqkI4mAORMZoc8Yisp+U6kTCipw76ZwdWD6DAaKf6LqyebHCGdu6ma9Hg2hzp9S7QOItUYe6DJOpPFzMGu6/fmCTrlR8GVbAj2QazXFQRd+qksEJ671cPSfcIUz0Rlqlt11nqCKoOzmr5PqBAsLu/eFtyNu/Wue+ZUsYeikOaJt1nCQE1kKeWCi51N2ZZc0r9FtNO67qmmWjfXcgnaupnq6zmCqKXZJbCtd4Xc54zG1VpqtUTZotVH+32FM3fy3QntxhyBGVOaQW3UWn7w+tS8jKVKNUudtVo8O8Xi+WdNM+dvkaHLVNoYSYVKN4MXx75thy6PNTKSAlk/g5fotDV90BtuywbQhEeu4PwKLr9CeGO+YNoZgaA3AnkjsDeCeCNm3ohrF1GbkurweDo4Tr3IiHEvMuJeZMQXRkbkQUb81pDx7mHzuF3fDYWNi0UnNjq1BxxxAMcXmgngWBx7V+ooLA2+8QVwDODon5AAjgEc/zM4EtILjqQXHMmFwRF7wJG8NXDcfLoQNGaJBcbPVNAdA2di9Sejbr/z60UzuEFFNQIvvtBM4MXi2LtAR2Fp8P0u8GLgRf+EBF4MvPhPvKh/ynkCiqdMRjQx23tMefKkBx7/AFBLAQI/ABQAAAAIAKuD7VYD1rN9XAIAAI8fAAAVACQAAAAAAAAAIAAAAAAAAABBc3NpZ25tZW50U3ByZWFkLmpzb24KACAAAAAAAAEAGAB4ZYwTebXZAQAAAAAAAAAAAAAAAAAAAABQSwUGAAAAAAEAAQBnAAAAjwIAAAAA"

}

}

Sample Success Response

{

"data": {

"jobId": 1689307060653

},

"message": [

"Job for spread data created successfully."

],

"status": 202,

"rest_audit_id": 14317

}

Sample Failed Request

{hosturl}ws/rest/service/v2/activity/sheets/assignments/spread

Inputs in JSON Raw Data:

{

"options": {

"project_number": "P-0056",

"sourceProjectId": "P-0056",

"source": "Primavera Cloud",

"projectType": ""

},

"_attachment": {

"zipped_file_name": "AssignmentSpread.zip",

"zipped_file_size": 780,

"zipped_file_content": "UEsDBBQAAAAIAKuD7VYD1rN9XAIAAI8fAAAVAAAAQXNzaWdubWVudFNwcmVhZC5qc29u7Zhda9swFIbvB/sPQdcp6CMNSe/SrBeDbSnpejV2odkiaNhysJRBGfnvkxVbcmzP6soam6IQiO33yOe1zpH1kN/v300mYJ9nP1mkwM3EnOsrP6hkCRfsY6wvogXGEE8b0heaMi2CWwIqicvbk1gIKj8wI7gE6yw2Q1ab+zVoaCYTQZBA1FB0IjeqkI4mAORMZoc8Yisp+U6kTCipw76ZwdWD6DAaKf6LqyebHCGdu6ma9Hg2hzp9S7QOItUYe6DJOpPFzMGu6/fmCTrlR8GVbAj2QazXFQRd+qksEJ671cPSfcIUz0Rlqlt11nqCKoOzmr5PqBAsLu/eFtyNu/Wue+ZUsYeikOaJt1nCQE1kKeWCi51N2ZZc0r9FtNO67qmmWjfXcgnaupnq6zmCqKXZJbCtd4Xc54zG1VpqtUTZotVH+32FM3fy3QntxhyBGVOaQW3UWn7w+tS8jKVKNUudtVo8O8Xi+WdNM+dvkaHLVNoYSYVKN4MXx75thy6PNTKSAlk/g5fotDV90BtuywbQhEeu4PwKLr9CeGO+YNoZgaA3AnkjsDeCeCNm3ohrF1GbkurweDo4Tr3IiHEvMuJeZMQXRkbkQUb81pDx7mHzuF3fDYWNi0UnNjq1BxxxAMcXmgngWBx7V+ooLA2+8QVwDODon5AAjgEc/zM4EtILjqQXHMmFwRF7wJG8NXDcfLoQNGaJBcbPVNAdA2di9Sejbr/z60UzuEFFNQIvvtBM4MXi2LtAR2Fp8P0u8GLgRf+EBF4MvPhPvKh/ynkCiqdMRjQx23tMefKkBx7/AFBLAQI/ABQAAAAIAKuD7VYD1rN9XAIAAI8fAAAVACQAAAAAAAAAIAAAAAAAAABBc3NpZ25tZW50U3ByZWFkLmpzb24KACAAAAAAAAEAGAB4ZYwTebXZAQAAAAAAAAAAAAAAAAAAAABQSwUGAAAAAAEAAQBnAAAAjwIAAAAA"

}

}

Sample Failed Response

{

"data": [],

"message": [

{

"message": "The API request contains empty value for: [projectType].",

"status": 12144

}

],

"status": 3000,

"rest_audit_id": 14316

}

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
_attachment _attachment is not specified in the request. 12524 The API request is missing the required information: [_attachment].
_attachment _attachment is empty/blank. 12525 The API request contains empty value for: [_attachment].
options options is empty/blank or not specified in the request. 3002 Invalid input.
source Source is not specified in the request 12007 The API request is missing the required information: [source]
source Wrong source value is specified in the request. 12703 Invalid value was found in a field: [source]. Allowed values: [Primavera Cloud, P6].
source Source is boolean or integer data type 12703 Invalid value was found in a field: [source]. Allowed value: [Primavera Cloud, P6].
source Source is empty 12702 The API request contains empty value for: [source]. Allowed value: [Primavera Cloud], P6
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/Shell is not an active shell. 1245 Create/Update/Delete cannot be performed when project/shell status is Inactive or View-Only or On-Hold.
project_number project_number is empty/blank. 12128 The API request contains empty value for: [project_number].
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 value is a blank. 12032 The API request contains empty value for: [sourceProjectId].
sourceProjectId sourceProjectId is not specified in the request. 12005 The API request is missing the required information: [sourceProjectId]
projectType projectType is not specified in the request. 12143 The API request is missing the required information: [projectType].
projectType projectType is empty/blank for system sheet. 12144 The API request contains empty value for: [projectType]. Allowed values: [Current, Baseline]
projectType projectType is of incorrect data type. 12142 Invalid value was found in a field: [projectType]. Allowed only alphanumeric value.
projectType An invalid value is passed in projectType for system sheet. 12145 Invalid value was found in a field: 'projectType'. Allowed values: [Current, Baseline]
zipped_file_name zipped_file_name is empty/blank. 12527 The API request contains empty value for: [zipped_file_name].
zipped_file_name zipped_file_name is missing in the request. 12518 The API request is missing the required information: [zipped_file_name].
zipped_file_name zipped_file_name is not a .zip file format. 12503 Invalid value was found in a field :[zipped_file_name]. Allowed only .zip files.
zipped_file_name zipped_file_name is an invalid value. 12521 Invalid value was found in a field: [zipped_file_name]. Allowed only alphanumeric characters in file name.
zipped_file_content zipped_file_content is not specified in the request. 12520 The API request is missing the required information: [zipped_file_content].
zipped_file_content zipped_file_content is empty/blank. 12529 The API request contains empty value for: [zipped_file_content].
zipped_file_content zipped_file_content is an invalid value. 12523 Invalid value was found in a field: [zipped_file_content]. Allowed only base64 encoded value.
zipped_file_size zipped_file_size is not specified in the request. 12528 The API request contains empty value for: [zipped_file_size].
zipped_file_size zipped_file_size is empty/blank. 12519 The API request is missing the required information: [zipped_file_size].
zipped_file_size zipped_file_size is an invalid value. 12522 Invalid value was found in a field: [zipped_file_size]. Allowed only integer value.
zipped_file_size Size mismatch with base encode file. 12526

Invalid value was found in a field: [zipped_file_size].

Actual file size does not match with [zipped_file_size].

Additional Validation Messages

Upon processing the uploaded zip file or processing the attached JSON file, the following messages may display in the Get Job Status Details section:

Use-case Scenario Error Message
Zip file is an invalid file format. The attached zip file contains an invalid file format. Only JSON file is allowed.
[activities] is missing in the uploaded JSON file. The JSON file is missing the required information: [activities].
Mandatory field is missing in the uploaded JSON file. The attached JSON file is missing the required information: [{property name}] for [activityCode] : {activityCode}
Mandatory field value is empty in the uploaded JSON file. The attached JSON file contains empty value for: [{property name}] for [activityCode] : {activityCode}
Missing field in [spread] object. The JSON file is missing the required information: [propertyName] in [spread] object. [activityCode]:{activityCode}
Mandatory field is an invalid data type in the uploaded JSON file. The attached JSON file contains value with invalid data type for: [{property name}] for [activityCode]: {activityCode}
Spread dates are in an invalid format. The API request contains an invalid value: [spreadDates]. Correct date format: [yyyy-MM-ddTHH:mm:ss]. [activityCode] :{activityCode}
JSON file contains property/data in an incorrect JSON template. Issue in parsing the JSON file. Invalid JSON file provided in the zip file.
System Activity Sheet is not configured while inserting System-type Activity Spread Date. System Activity Sheet is not configured for the shell.
System Activity Sheet is configured through Gateway while inserting System-type Activity Spread Data. System Activity Sheet is configured with Gateway and is not supported with this API.
System Activity Sheet is configured for Oracle Primavera Cloud but source is given as P6 while inserting System-type Activity Spread Data. System Activity Sheet is configured with source as Oracle Primavera Cloud.
Timescale is not set as Daily. The API request contains invalid value for: [timescale]. Allowed values {daily}.
Resource Code is missing in the Activity Assignment. [resourceCode]/roleCode] is not assigned to any activity in Activity Sheet. [activityCode]: {activityCode}/Resource Code: <resourceCode>/role Code: <roleCode>
Activity Code is not configured in Unifier for the project_number and sourceProject Id. The JSON file containing [activityCode] not configured in the system. [activityCode]: {activityCode}