Editing Allocation from Staff in an Investment using REST API
search cancel

Editing Allocation from Staff in an Investment using REST API

book

Article ID: 373305

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

How can I edit (e.g.: remove) the Total Allocation from Staff using the REST API?

Environment

Clarity 16.2.2

Resolution

Perform the following steps:

  1. Get the Custom Investment Instance ID (e.g.: 5000001)
  2. Use the following code to get the details of the Staff (adjust the instance ID if needed):

GET    https://<hostname>/ppm/rest/v1/obaStaffs?filter=(+(investment+=+5000001)+)&limit=100

You must also add this as part of the Request Header:

x-api-association-key: obaStaffs~resources~base_object_only

You will receive a response like:

{
    "_pageSize": 100,
    "_self": "<hostname>/ppm/rest/v1/obaStaffs?filter=(+(investment+=+5000001)+)&limit=100",
    "_metadata": {},
    "_totalCount": 1,
    "_results": [
        {
            "_internalId": 5006000,
            "resources____uniqueName": "cherylAmos",
            "_self": "<hostname>/ppm/rest/v1/obaStaffs/5006000",
            "resources____fullName": "Amos, Cheryl"
        }
    ],
    "_recordsReturned": 1
}

(If you have more than one resource, you will get more results)

 

  1. Then, for the result(s) you want to zero out:

PATCH    https://<hostname>/ppm/rest/v1/obaStaffs

In the Request Header, include:

x-api-association-key: obaStaffs~resources~base_object_only

Body: (raw/JSON) - replace 5006000 with the staff ID that you receive in the previous step:

{
    "d": [
        {
            "allocationCurve": {
                "workEffortUnit": "hours",
                "pattern": "uniform",
                "total": 0
            },
            "_internalId": 5006000
        }
    ]
}

  1. Run the 'Update Investment Allocations and Usage' to update the values in the custom investment instance.