search cancel

Updating User Resource Property employmentType via REST API

book

Article ID: 258259

calendar_today

Updated On:

Products

Clarity PPM SaaS

Issue/Introduction

We are trying to update the attribute c_employmentType on resource object and it is listed in the API documentation as an attribute we can update via the PATCH. I get the following error when I attempt to update it. 

{
    "resourceId": "5092486",
    "httpStatus": "400",
    "errorMessage": "Attribute(s) 'c_employmentType' are not supported.",
    "errorCode": "validation.invalidApiAttribute"
}

Environment

Release : 16.x

Component: CLARITY REST API

Cause

The c_employmentType is not a valid attribute in request schema as per documentation and hence resulting in above error.

The valid attribute is employmentType, please refer details below

  • Operation: PATCH
  • API:  /users/{usersInternalId}
  • Documentation: http(s)://hostname.domain.com/niku/rest/describe/index.html#!/Other32Resources/CaPpmPOSTusersEntity

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=VIrA0w5At5nDQuS2b0VXEg==

Resolution

The permissible value for attribute employmentType is id of Employment Type as string. The available values are mentioned below.

  • Employee = "300"
  • Contractor = "301"

So a PATCH request updating user-id employment type will have below request body

#Updating Employment Type to Employee

{
  "employmentType""300"
}