Post

2 followers Follow
0
Avatar

How to change Resource Requests from Draft to Approved in bulk via API

We loaded thousands of resource requests from our legacy system.  They get loaded in DRAFT state

if we open each one up in the gui, we can change to approve, but we want to do in bulk.

I tried two API endpoints - upsert and lifecycle - both give me errors as per below.

Any suggestions?

curl -X POST -H "Authorization: ApiKey <mykey>” -d "{ \"insertEntity\": { \"Id\": \"/ResourceRequest/PRJ-2021070-4188\" }, \"updateEntity\": { \"Id\": \"/ResourceRequest/PRJ-2021070-4188\", \"State\": \"Approved\"} }" https://api.clarizentb.com/v2.0/services/data/upsert
{
"errorCode": "InvalidOperation",
"message": "Invalid operation: Field 'State' cannot be updated. The field is marked 'read-only'.",
"referenceId": "aUUZVulHnmM3TVRcbGnWL"

 


curl -X POST -H "Authorization: ApiKey <mykey>" -d "{ \"ids\": [\"/ResourceRequest/1m1uhgc3tyeo5arom0a170nz02512\"], \"operation\":\"Approve\"}" https://api2.clarizen.com/V2.0/services/data/Lifecycle

Response:
{
"errorCode": "Unauthorized",
"message": "You don't have permission to Approve this object\r\n",
"referenceId": "2kf25Ubp8qsAUP0VBTowYX"
}

 

Ed Sullivan Answered

Official comment

Avatar

Hi Ed,

You can do this via ChangeState to one or more staffing requests. Examples:

{
  "ids": [
   "/ResourceRequest/2j78sqe519ganfjjddrurq1gj2872"
  ],
  "state": "Requested"
}

{
  "ids": [
    "/ResourceRequest/2j78sqe519ganfjjddrurq1gj2872"
  ],
  "state": "Approved"
}

I hope this helps.

Roland

Roland Pumputis
Comment actions Permalink

Please sign in to leave a comment.

3 comments