Edit KRA in Library API - v3

Use this API to edit KRA in the library.

Request URL:

https://people.zoho.com/api/v3/performance/kra

Scope:

ZOHOPEOPLE.performance.{operation_type}

Possible Operation Types:

ALL - Full access to data
Update - Only to update data

Request Type:

PUT

Parameters:

Parameter NameValues allowedDefault ValueMandatoryDescription
kras*JSONArray-Yes[{"zoho_id": "<Record ID>", "name": "<KRA Name> ","description": "< Description>" , "minimum_range" : Min Range , "maximum_range" : Max Range},...]

Error Codes:

Error CodeDescription
SERVER_ERRORSERVER_ERROR - Unexpected and unhandled exception in Server. Contact support team.
PERMISSION_ERRORPERMISSION_ERROR - Permission denied to edit record.
ALREADY_EXISTSALREADY_EXISTS - Competency Already Exist.
MANDATORY_ERRORMANDATORY_ERROR - Parameter name cannot be null or empty. Please provide a valid value.
INVALID_DATAINVALID_DATA - Invalid Data.
RANGE_ERRORRANGE_ERROR - The `minimum_range` parameter must be less than or equal to the `maximum_range` parameter.
MAXIMUM_LENGTHMAXIMUM - Maximum length exceeded for input.Please provide valid data.

Note: Edit upto 20 records.

Threshold Limit: 20 requests | Lock period: 5 minutes

Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.

Request:

Copied   curl --location --request PUT 'https://people.zoho.com/api/v3/performance/kra' \
   --header 'Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN' \
   --header 'Content-Type: application/json' \
   --data '{
     "kras": [
       {
           "zoho_id": "100002000002156073",
           "name": "KRA 6 Updated",
           "description": "Updated description",
           "minimum_range": 1,
           "maximum_range": 5
       },
       {
           "zoho_id": "100002000002156077",
           "name": "KRA 7 Updated",
           "description": "Description 2",
           "minimum_range": 2,
           "maximum_range": 10
       }
     ]
   }'
   
  
Copied   fetch("https://people.zoho.com/api/v3/performance/kra", {
      method: "PUT",
      headers: {
          "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN",
          "Content-Type": "application/json"
      },
      body: JSON.stringify({
          kras: [
              { zoho_id: "100002000002156073", name: "KRA 6 Updated", description: "Updated description", minimum_range: 1, maximum_range: 5 },
              { zoho_id: "100002000002156077", name: "KRA 7 Updated", description: "Description 2", minimum_range: 2, maximum_range: 10 }
          ]
      })
   });
   
  
Copied   import requests
   
   url = "https://people.zoho.com/api/v3/performance/kra"
   
   payload = {
       "kras": [
           {"zoho_id": "100002000002156073", "name": "KRA 6 Updated", "description": "Updated description", "minimum_range": 1, "maximum_range": 5},
           {"zoho_id": "100002000002156077", "name": "KRA 7 Updated", "description": "Description 2", "minimum_range": 2, "maximum_range": 10}
       ]
   }
   
   headers = {
       "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN",
       "Content-Type": "application/json"
   }
   
   res = requests.put(url, json=payload, headers=headers)
   print(res.json())
   
  
Copied       OkHttpClient client = new OkHttpClient();
   
   String bodyJson = "{ \"kras\": ["
           + "{\"zoho_id\":\"100002000002156073\", \"name\":\"KRA 6 Updated\", \"description\":\"Updated description\", \"minimum_range\":1, \"maximum_range\":5},"
           + "{\"zoho_id\":\"100002000002156077\", \"name\":\"KRA 7 Updated\", \"description\":\"Description 2\", \"minimum_range\":2, \"maximum_range\":10}"
           + "] }";
   
   RequestBody body = RequestBody.create(
           bodyJson,
           MediaType.get("application/json; charset=utf-8")
   );
   
   Request request = new Request.Builder()
           .url("https://people.zoho.com/api/v3/performance/kra")
           .put(body)
           .addHeader("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN")
           .addHeader("Content-Type", "application/json")
           .build();
   
   Response response = client.newCall(request).execute();
   
  
Copied   kraList = List();
   
   kra1 = Map();
   kra1.put("zoho_id", "100002000002156073");
   kra1.put("name", "KRA 6 Updated");
   kra1.put("description", "Updated description");
   kra1.put("minimum_range", 1);
   kra1.put("maximum_range", 5);
   
   kra2 = Map();
   kra2.put("zoho_id", "100002000002156077");
   kra2.put("name", "KRA 7 Updated");
   kra2.put("description", "Description 2");
   kra2.put("minimum_range", 2);
   kra2.put("maximum_range", 10);
   
   kraList.add(kra1);
   kraList.add(kra2);
   
   payload = Map();
   payload.put("kras", kraList);
   
   headers = Map();
   headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");
   headers.put("Content-Type", "application/json");
   
   response = invokeurl
   [
       url: "https://people.zoho.com/api/v3/performance/kra"
       type: PUT
       headers: headers
       parameters: payload
   ];
   
   info response;
   
  

Response - Success:

Copied{
    "editedCount": 2,
    "edited": [
        {
            "zoho_id": "100002000002156073",
            "name": "KRA 6",
            "description": ""
        },
        {
            "zoho_id": "100002000002156077",
           "name" : "KRA 7"
            "description": "Description 2"
        }
    ],
    "message": "Request processed successfully.",
    "status": "success"
}

Response - Failure:

Copied{
   "code": "MULTI_ERROR",
   "message": "Error occurred",
   "errors": [
       {
           "code": "MANDATORY_ERROR",
           "message": "Parameter name cannot be null or empty. Please provide a valid value",
           "recordIndex": 1
       },
       {
          "code": "ALREADY_EXISTS",
           "message": "KRA Already Exist",
           "recordIndex": 2
       },
        {
           "code": "MAXIMUM_LENGTH",
           "message": "Maximum length exceeded for input.Please provide valid data.",
           "recordIndex": 3
         },
        {
            "code": "INVALID_DATA",
            "message": "Invalid Data",
            "recordIndex": 4
         },
        {

           "code": "RANGE_ERROR",
           "message": "The `minimum_range` parameter must be less than or equal to the `maximum_range` parameter.",
           "recordIndex": 5
         }
   ]

}

Response - Failure:

Copied{

 "code": "PERMISSION_ERROR",

 "message": "Permission denied to edit record"

}