Create and Update Resources in the Master Rate Sheet

POST /ws/rest/service/v2/rate/sheet/resources

Purpose

Create or update resources in the Master Rate Sheet.

Note:

  • Resources cannot be removed once they are created in the Master Rate Sheet.
  • For P6 and Primavera Cloud source applications, rates are applied only when creating resources and roles in the Master Rate Sheet. These rates will not be considered during updates to the resources and roles data.
  • For sources such as Others or User-Defined, rates are considered when creating and updating resources and roles data in the Master Rate Sheet.

PUT or Delete operations are not included.

Prerequisites

Ensure:

  • You have the necessary integration permissions to run this service.
  • rateType and costType are optional fields in the ratesBreakdown array. If they are not entered, Standard and Direct will be the default breakdown for Rates.
  • The request must include unique combinations of Rate Type and Cost Type. Otherwise, an error message displays when you specify the same combination with a different rate.

    Note:

    All allowed parameter values are case-sensitive.

Request Format

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

{

"options":{{"source": "<value>", "type": "<value>"}},

"data":[]

}

Request Parameters Supported in "options" JSON Map

The following request parameters can be included in the "options" JSON map:

Request Parameter Required? Data Type Description
source Yes String The external application from which project data is populated. Valid values include: "Primavera Cloud", "P6", and "Others".

Request Parameters Supported in "data" JSON Map

The following request parameters can be included when the "type" value is set to "RESOURCE" in the "options" JSON map:

Request Parameter Required? Data Type Description
resourceCode Yes String The unique identifier for the resource. For example, "AbrahamM".
workspaceCode Yes, if source is "Primavera Cloud". Otherwise, optional for all other sources. String The workspace code specified in the Primavera Cloud application.
resourceName Yes String The name of the resource. For example, Molly Abraham.
resourceStatus No String

Determines if the resource is currently active. Valid values include: "Active" (default) and "Inactive".

If this field value is not provided, defaults to "Active".

parentResourceCode No String

The unique identifier for the parent resource.

If this field is empty or not present for a resource, it implies the resource does not have a parent resource.

resourceType No String

The type of resource. For example, "Labor", "Material".

If the field value is not provided in the request, defaults to "Labor".

resourceCurrency No String

Currency of the rate.

If the field value is not provided in the request, defaults to the company currency for that resource.

unitsPerTime No Double The resource units per time. It is used in calculating the number of units in the Manual Activity Sheet. Defaults to 1.
rates No Array

An array of rates which contains a list of resource rates and resource rate effective dates.

The sample request below shows the sample data for rates array. If rates are not available, no rates will be inserted for the corresponding resource.

If the "Source" parameter is "P6" or "Primavera Cloud", rates will be ignored when the role is updated. They will only be considered when the role is created.

resourceEffectiveDate No Date The effective date for the rate. This is mandatory in the rates array.
ratesBreakdown No Array

The ratesBreakdown array contains a list of resource rates for respective rate Type and cost Type for the effective date.

The sample request below shows the sample data for ratesBreakdown array.

If rates are not present, no rates will be inserted for the corresponding resource.

resourceStandardRate No Double The price per unit for the resource. It is mandatory in the ratesBreakdown Array.
costType No String

The type of cost for the Resource. Defaults to "Standard" if the parameter is not specified.

The list of allowed costTypes will be picked from DE - SYS Cost Breakdown Type.

rateType No String

Type of Cost for the Resource. Defaults to "Direct" if the parameter is not specified.

The list of allowed rateTypes will be picked from DE - SYS Rate Breakdown Type.

parentWorkspaceCode No String Specify this optional field if the "Source" value is "Primavera Cloud". This parameter checks whether the parent Resource Code exists in the system and if the parent and child workspace codes are under different workspaces.
ext_resc_id No Integer Specify this optional field if "Source" value is "Primavera Cloud". This is an internal Resource ID in Primavera Cloud. It is used for ResourceCode update.

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 Request

This is a sample request to create Primavera Cloud resources:

{

"options": {

"source": "Primavera Cloud"

},

"data": [

{

"resourceCode": "Child1Rate4",

"resourceName": "Child1Rate4",

"workspaceCode": "NON_PROD3",

"parentResourceCode": "Parent",

"resourceType": "Labor",

"resourceCurrency": "USD",

"resourceStatus": "Active",

"unitsPerTime": 10,

"rates": [

{

"resourceEffectiveDate": "2020-02-03",

"ratesBreakdown": [

{

"resourceStandardRate": 100,

"costType": "Food",

"rateType": "Direct"

},

{

"resourceStandardRate": 100

}

]

},

{

"resourceEffectiveDate": "2020-02-05",

"ratesBreakdown" : [

{

"resourceStandardRate": 50,

"costType" : "Food",

"rateType" : "Direct"

},

{

"resourceStandardRate": 100,

"costType" : "Standard",

"rateType" : "Indirect"

}

]

}

]

}

]

}

Sample Success Response

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

{

"data": [

{

"resourceStatus": "Active",

"resourceCurrency": "USD",

"resourceCode": "Child1Rate4",

"workspaceCode": "NON_PROD3",

"unitsPerTime":10,

"rates": [

{

"ratesBreakdown": [

{

"rateType": "Direct",

"costType": "Food",

"id": 920,

"resourceStandardRate": 100.0

},

{

"rateType": "Direct",

"costType": "Standard",

"id": 921,

"resourceStandardRate": 100.0

}

],

"resourceEffectiveDate": "2020-02-03",

"id": 913

},

{

"ratesBreakdown": [

{

"rateType": "Direct",

"costType": "Food",

"id": 922,

"resourceStandardRate": 50.0

},

{

"rateType": "Indirect",

"costType": "Standard",

"id": 923,

"resourceStandardRate": 100.0

}

],

"resourceEffectiveDate": "2020-02-05",

"id": 914

}

],

"resourceName": "Child1Rate4",

"id": 118,

"parentResourceCode": "Parent",

"resourceType": "Labor"

}

],

"message": ["success"],

"status": 200,

"rest_audit_id": 1234

}

Sample Failure Request for Resources

A request with incorrect data is sent in the following format:

{

"options": {"source": "Primavera Cloud"},

"data": [

{

"resourceCode": "Child11Rate41",

"resourceName": "Child11Rate41",

"workspaceCode": "NON_PROD",

"resourceType": "Labor",

"resourceCurrency": "USD",

"parentResourceCode":"Rate4",

"parentWorkspaceCode":123,

"resourceStatus": "Active",

"ext_resc_id":100203,

"unitsPerTime": 10,

"rates": [

{

"resourceEffectiveDate": "2020-02-03",

"ratesBreakdown": [

{

"resourceStandardRate": 100,

"costType": "Food",

"rateType": "Direct"

},

{

"resourceStandardRate": 100

}

]

},

{

"resourceEffectiveDate": "2020-02-05",

"ratesBreakdown" : [

{

"resourceStandardRate": 50,

"costType" : "Food",

"rateType" : "Direct"

},

{

"resourceStandardRate": 100,

"costType" : "Standard",

"rateType" : "Indirect"

}

]

}

]

},

{

"resourceCode": "Rate42",

"resourceName": "Rate42",

"workspaceCode": "NON_PROD",

"resourceType": "Labor",

"resourceCurrency": "USD",

"resourceStatus": "Active",

"ext_resc_id":100204,

"unitsPerTime": 10,

"rates": [

{

"resourceEffectiveDate": "2020-02-03",

"ratesBreakdown": [

{

"resourceStandardRate": 100,

"costType": "Food",

"rateType": "Direct"

},

{

"resourceStandardRate": 100

}

]

},

{

"resourceEffectiveDate": "2020-02-05",

"ratesBreakdown" : [

{

"resourceStandardRate": 50,

"costType" : "Food",

"rateType" : "Direct"

},

{

"resourceStandardRate": 100,

"costType" : "Standard",

"rateType" : "Indirect"

}

]

}

]

},

{

"resourceCode": "Child11Rate43",

"resourceName": "Child11Rate43",

"workspaceCode": "NON_PROD",

"resourceType": "Labor",

"resourceCurrency": "USD",

"parentResourceCode":"Rate4",

"parentWorkspaceCode":"NON_PROD",

"resourceStatus": "Active",

"ext_resc_id":100206,

"unitsPerTime": 10

}

]

}

Sample Partial Failure Response

The REST service returns a partial failure response in the following format:

{

"data": [

{

"resourceStatus": "Active",

"resourceCurrency": "USD",

"unitsPerTime": 10,

"resourceCode": "Rate42",

"ext_resc_id": 100204,

"workspaceCode": "NON_PROD",

"rates": [

{

"ratesBreakdown": [

{

"rateType": "Direct",

"costType": "Food",

"id": 122578,

"resourceStandardRate": 50.0

},

{

"rateType": "Direct",

"costType": "Standard",

"id": 122579,

"resourceStandardRate": 100.0

},

{

"rateType": "Indirect",

"costType": "Standard",

"id": 122605,

"resourceStandardRate": 100.0

}

],

"resourceEffectiveDate": "2020-02-03",

"id": 122216

},

{

"ratesBreakdown": [

{

"rateType": "Direct",

"costType": "Food",

"id": 122580,

"resourceStandardRate": 50.0

},

{

"rateType": "Indirect",

"costType": "Standard",

"id": 122581,

"resourceStandardRate": 100.0

}

],

"resourceEffectiveDate": "2020-02-05",

"id": 122217

}

],

"resourceName": "Rate42",

"id": 2,

"parentResourceCode": "",

"resourceType": "Labor"

}

],

"message": [

{

"ResourceCode": "Child11Rate41",

"WorkspaceCode": "NON_PROD",

"ErrorStatus": 12476,

"ErrorMessage": "Invalid value was found in a field: [parentWorkspaceCode]. Allowed only string value or use quotations. "

},

{

"ResourceCode": "Child11Rate43",

"workspaceCode": "NON_PROD",

"ErrorStatus": 12414,

"ErrorMessage": "Invalid value was found in a field: [parentResourceCode]. Incorrect [parentResourceCode] provided."

}

],

"rest_audit_id": 7926,

"status": 3000

}

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
source Source is not specified in the request. 3002 Invalid input.
source Source value is incorrect. 12008 Invalid value was found in a field: [source]. Allowed values: [Primavera Cloud, P6, Others].
source Source value is null or empty. 12030 The API request contains empty value for: [source]. Allowed values: [Primavera Cloud, P6, Others].
source Source value is boolean or number datatype. 12008 Invalid value was found in a field: [source]. Allowed values: [Primavera Cloud, P6, Others].
resourceCode resourceCode missing in the request. 12400 The API request is missing the required information: [resourceCode].
resourceCode resourceCode is empty. 12401 The API request contains an empty value for: [resourceCode].
resourceCode resourceCode value is not of String datatype. 12402 Invalid value was found in a field: [resourceCode]. Allowed only string value or use quotations.
resourceCode resourceCode exceeds 120 characters 12403 Invalid value was found in a field: [resourceCode]. Allowed length: [120]. Resource Code: <Resource Code>
resourceCode When the source is "Primavera Cloud", a duplicate resourceCode exists in the same workspace. 12404 Duplicate value was found in a field: [resourceCode] in the API request. Only unique value allowed for [resourceCode] under a workspace.
resourceCode When the source is "P6" or "Others", duplicate resourceCode exists. 12407 Duplicate value was found in a field: [resourceCode] in the API request. Only unique value allowed for [resourceCode].
resourceCode The parent and child are given the same code. 12468 Duplicate value was found in a field: [resourceCode] in the API request. [resourceCode] cannot be same as [parentResourceCode]. Resource Code: <Resource Code>.
resourceCode If a resource doesn't have any child resource only then it will be allowed to move. Otherwise throw an error message 12473 Invalid value was found in a field: [parentResourceCode]. [parentResourceCode] cannot be moved under a [ResourceCode] lower in the hierarchy. Resource Code: <Resource Code>.
workspaceCode When the source is "Primavera Cloud", workspaceCode is missing in the request. 12405 The API request is missing the required information: [workspaceCode]. Resource Code: <Resource Code>.
workspaceCode When the source is "Primavera Cloud", the workspaceCode is empty in the data array. 12406 The API request contains an empty value for: [workspaceCode]. Resource Code: <Resource Code>.
workspaceCode workspaceCode is not of String datatype. 12450 Invalid value was found in a field: [workspaceCode]. Allowed only string value or use quotations. Resource Code: <Resource Code>.
workspaceCode workspaceCode exceeds 60 characters. 12464 Invalid value was found in a field: [workspaceCode]. Allowed length: [60]. Resource Code: <Resource Code>.
resourceName resourceName exceeds 120 characters. 12408 Invalid value was found in a field: [resourceName]. Allowed length: [120]. Resource Code: <Resource Code>
resourceName resourceName is not of String datatype. 12409 Invalid value was found in a field: [resourceName]. Allowed only string value or use quotations. Resource Code: <Resource Code>.
resourceName resourceName is empty. 12410 The API request contains an empty value for: [resourceName]. Resource Code: <Resource Code>
resourceName resourceName is missing in the request. 12411 The API request is missing the required information: [resourceName]. Resource Code: <Resource Code>.
resourceStatus resourceStatus is invalid. 12412 Invalid value was found in a field: [resourceStatus]. Allowed values: [Active, Inactive]. Resource Code: <Resource Code>.
resourceStatus resourceStatus is empty or not of String datatype. 12412 Invalid value was found in a field: [resourceStatus]. Allowed values: [Active, Inactive]. Resource Code: <Resource Code>.
parentResourceCode parentResourceCode missing in the request. If parentResourceCode is not present as resourceCode in the request, and not existing in Master Rate Sheet. 12414 Invalid value was found in a field: [parentResourceCode]. Incorrect [parentResourceCode] provided. Resource Code: <Resource Code>.
parentResourceCode parentResourceCode is not of String datatype. 12415 Invalid value was found in a field: [parentResourceCode]. Allowed only string value or use quotations. Resource Code: <Resource Code>.
resourceType resourceType is invalid or empty. 12416 Invalid value was found in a field: [resourceType]. Allowed values: [Labor, Nonlabor or Material]. Resource Code: <Resource Code>.
resourceType resourceType is not of String datatype. 12416 Invalid value was found in a field: [resourceType]. Allowed values: [Labor, Nonlabor or Material]. Resource Code: <Resource Code>.
resourceType For source type "P6", "Primavera Cloud" or "Others", the resource has been assigned to any activity sheet and the Type has been updated. 12472 The API request contains different type for an assigned Resource. Type update for a Resource assigned to an Activity Sheet is not allowed. Resource Code: <Resource Code.
resourceCurrency Invalid resourceCurrency (If resourceCurrency not present or configured in Unifier). 12418 Invalid value was found in a field: [resourceCurrency]. Currency <currency id> of Resource <resourceCode> doesn't exist in Unifier. Resource Code: <Resource Code>.
resourceCurrency Non-String value provided for resourceCurrency. 12419 Invalid value was found in a field: [resourceCurrency]. Allowed only string value or use quotations. Resource Code: <Resource Code>.
resourceCurrency resourceCurrency value is empty. 12413 The API request contains an empty value for: [resourceCurrency]. Resource Code: <Resource Code>.
resourceCurrency For source type "Others", the resource has been assigned to any activity sheet and currency has been updated. 12470 The API request contains different currency for an assigned Resource/Role. Currency update for a Resource/Role assigned to an Activity Sheet is not allowed. Resource Code: <Resource Code>.
resourceCurrency For source type "Others", the resource has rates and the currency has been updated. 12471

The API request contains different currency for an existing Resource/Role rate. Currency update for Resource/Role with existing rates is not allowed.

Resource Code: <Resource Code>.

unitsPerTime Invalid unitsPerTime (Not Double) 12436 Invalid value was found in a field: [unitsPerTime]. Allowed only positive decimal value. Resource Code: <Resource Code>.
unitsPerTime unitsPerTime exceeds 1000 or is less than 0. 12437 Invalid value was found in a field: [unitsPerTime]. Enter a value greater than 0 and less than or equal to 1000. Resource Code: <Resource Code>.
rates A non-Array value is specified for rates. 12438 Invalid data format was found in a field: [rates]. Check sample API request for more details. Resource Code: <Resource Code>.
rates When source is set to "Others", and the resource status is inactive, rates cannot be updated. 12462 The API request contains rate for an inactive Resource. Rates update for an inactive Resource is not allowed. Resource Code: <Resource Code>.
resourceEffectiveDate Invalid resourceEffectiveDate format. 12420 The API request contains an invalid value: [resourceEffectiveDate]. Correct date format [yyyy-MM-dd]. Resource Code: <Resource Code>.
resourceEffectiveDate resourceEffectiveDate is empty when the rates breakdown is provided. 12451 The API request contains empty value for: [resourceEffectiveDate]. This field is required in rates array. Resource Code: <Resource Code>.
resourceEffectiveDate resourceEffectiveDate is missing when rates breakdown is provided 12452 The API request is missing the required information: [resourceEffectiveDate]. This field is required in rates array. Resource Code: <Resource Code>.
resourceEffectiveDate Duplicate resourceEffectiveDate exists under a resourceCode in the request. 12453 Duplicate value was found in a field: [resourceEffectiveDate] in the API request. Only unique rate breakdown is allowed corresponding to [resourceEffectiveDate] under a Resource Code. Resource Code: <Resource Code>.
ratesBreakdown A non-Array value is provided for ratesBreakdown. 12443 Invalid data format was found in a field: [ratesBreakdown]. Check sample API request for more details. Resource Code: <Resource Code>.
ratesBreakdown The resourceEffectiveDate is given and the ratesBreakdown is not provided with any resourceStandardRate for that resourceEffectiveDate 12466 The API request is missing the required information: [resourceStandardRate] for a resourceEffectiveDate. Check sample API request for more details. Resource Code: <Resource Code>.
resourceStandardRate Invalid resourceStandardRate (Not Double) 12456 Invalid value was found in a field: [resourceStandardRate]. Allowed only positive decimal value. Resource Code: <Resource Code>.
resourceStandardRate resourceStandardRate is missing when the ratesBreakdown is provided 12457 The API request is missing the required information: [resourceStandardRate]. This field is required in rates array. Resource Code: <Resource Code>.
resourceStandardRate Duplicate resourceStandardRate included in the request. 12459 Duplicate value was found in a field: [resourceStandardRate] in the API request. Only unique [resourceStandardRate] is allowed corresponding to a cost type & rate type. Resource Code: <Resource Code>.
resourceStandardRate resourceStandardRate exceeds 999999999999999 or is less than 0. 12460 Invalid value was found in a field: [resourceStandardRate]. Allowed Range [0-999999999999999]. Resource Code: <Resource Code>.
costType Invalid costType (Not part of the list of configured costTypes in the Data element). 12448 Invalid value was found in a field: [costType]. This value is not configured in the dropdown for data definition [SYS Cost Breakdown Type]. Resource Code: <Resource Code>.
costType costType is empty or not of String datatype. 12448 Invalid value was found in a field: [costType]. This value is not configured in the dropdown for data definition [SYS Cost Breakdown Type]. Resource Code: <Resource Code>.
rateType Invalid rateType(Not part of the list of configured rateTypes in Data element. 12449 Invalid value was found in a field: [rateType]. This value is not configured in the dropdown for data definition [SYS Rate Breakdown Type]. Resource Code: <Resource Code>.
rateType rateType is empty or not of String datatype. 12449 Invalid value was found in a field: [rateType]. This value is not configured in the dropdown for data definition [SYS Rate Breakdown Type]. Resource Code: <Resource Code>.
parentWorkspaceCode parentWorkspaceCode is not of String datatype. 12476 Invalid value was found in a field: [parentWorkspaceCode]. Allowed only string value or use quotations. Resource Code: <Resource Code>.
parentWorkspaceCode parentWorkspaceCode exceeds 60 characters. 12477 Invalid value was found in a field: [parentWorkspaceCode]. Allowed length: [60]. Resource Code: <Resource Code>
ext_resc_id ext_resc_id is not of String datatype. 12478 Invalid value was found in a field: [ext_resc_id]. Allowed only positive integer value.