Create and Update Roles in the Master Rate Sheet

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

Purpose

Create or update roles in the Master Rate Sheet.

Note:

Roles cannot be removed after they are created in the Master Rate Sheet.

PUT or Delete operations are not included.

Prerequisites

You must have the necessary permissions to run this service.

Request Format

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

{

"options":{

{"Source": "<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 "ROLE" in the "options" JSON map:

Request Parameter Required? Data Type Description
       
       
       
parentWorkspaceCode No String Specify this field if "Source" value is "Primavera Cloud". This parameter checks if the parent Role 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". his is an internal Role ID in Primavera Cloud. It is used for Role code update.

Sample Success Request

{

"options":{

"source": "Primavera Cloud"},

"data":[

{"roleCode":"Manager",

"roleName": "Manager",

"workspaceCode": "Workspace1",

"unitsPerTime":150,

"roleCurrency": "USD",

"roleStatus":"Active",

"rates": [

{"roleEffectiveDate": "2020-02-01",

"ratesBreakdown" : [{"roleStandardRate": 100 ,

"costType":"Food",

"rateType":"Direct"

},

{"roleStandardRate": 100}

]

},

{"roleEffectiveDate": "2018-02-01",

"ratesBreakdown" : [

{"roleStandardRate": 100 ,

"costType":"Food",

"rateType":"Direct"

},

{"roleStandardRate": 100}

]

}

]

}

]

}

Sample Success Response

{

"data": [

{

"roleCurrency": "USD",

"unitsPerTime": 150,

"roleCode": "Manager",

"workspaceCode": "Workspace1",

"rates": [

{

"ratesBreakdown": [

{

"roleStandardRate": 100.0,

"rateType": "Direct",

"costType": "Food",

"id": 1568

},

{

"roleStandardRate": 100.0,

"rateType": "Direct",

"costType": "Standard",

"id": 1569

}

],

"id": 1247,

"roleEffectiveDate": "2020-02-01"

},

{

"ratesBreakdown": [

{

"roleStandardRate": 100.0,

"rateType": "Direct",

"costType": "Food",

"id": 1570

},

{

"roleStandardRate": 100.0,

"rateType": "Direct",

"costType": "Standard",

"id": 1571

}

],

"id": 1248,

"roleEffectiveDate": "2018-02-01"

}

],

"roleName": "Manager",

"id": 92,

"roleStatus": "Active"

}

],

"message": [

"success"

],

"status": 200,

"rest_audit_id": 2242

}

Sample Failed Response for Roles

{

"data": [],

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

"status": 12422,

"rest_audit_id": 1395

}

Sample Failed Request for Roles

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

{

"options":{

"source":"Primavera Cloud"

},

"data":[

{

"roleCode": "CE4",

"roleStatus": "Active",

"roleName": "CE4",

"ext_role_id" : 231454, // This id is the internal id from Primavera Cloud and this attribute will be considered only for Primavera Cloud Roles

"workspaceCode": "NON_PROD",

"roleCurrency": "USD",

"rates": [

{

"roleEffectiveDate": "2020-02-07",

"ratesBreakdown": [

{

"roleStandardRate": 50,

"costType": "Food",

"rateType": "Direct"

},

{

"roleStandardRate": 100,

"costType": "Food",

"rateType": "Indirect"

}

]

}

]

},

{

"roleCode": "CE5",

"roleStatus": "Active",

"roleName": "CE5",

"workspaceCode": "NON_PROD3",

"parentRoleCode": "CE4",

"parentWorkspaceCode": 123,

"ext_role_id" : 12390,

"roleCurrency": "USD",

"rates": [

{

"roleEffectiveDate": "2020-02-07",

"ratesBreakdown": [

{

"roleStandardRate": 50,

"costType": "Food",

"rateType": "Direct"

},

{

"roleStandardRate": 100,

"costType": "Standard",

"rateType": "Indirect"

}

]

}

]

}

]

}

Sample Partial Success Response for Roles

The REST service returns a partially successful response in the following format:

{

"data": [

{

"roleCurrency": "USD",

"roleCode": "CE4",

"workspaceCode": "NON_PROD",

"rates": [

{

"ratesBreakdown": [

{

"roleStandardRate": 50.0,

"rateType": "Direct",

"costType": "Food",

"id": 122620

},

{

"roleStandardRate": 100.0,

"rateType": "Indirect",

"costType": "Food",

"id": 122621

}

],

"id": 122240,

"roleEffectiveDate": "2020-02-07"

}

],

"roleName": "CE4",

"id": 10,

"ext_role_id": 231454,

"parentRoleCode": "",

"roleStatus": "Active"

}

],

"message": [

{

"WorkspaceCode": "NON_PROD3",

"ErrorStatus": 12476,

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

"RoleCode": "CE5"

}

],

"rest_audit_id": 7933,

"status": 3000

}