Update User


PUT /v1/api/corporate/user

​Use this API to update an existing employee’s details. Please use Add/Update Users for bulk.


Request Parameters

Name Data Type Description Type Remark
corp_email_id string Employee Email Address Payload Mandatory (Cannot be changed)
name string Employee Name Payload Mandatory
groups list of strings Employee Groups Payload Mandatory
user_status string User Status Payload Optional (inactive is the only allowed value)
employee_phone_number string Employee Phone Number Payload Optional
employee_cost_center string Employee Cost Center Payload Optional
employee_code string Employee Code Payload Optional
employee_base_location string Employee base Location Payload Optional
employee_designation string Employee Designation Payload Optional
employee_band string Employee Band Payload Optional
employee_gender string Employee Gender Payload Optional
manager_name string Employee Manager Name Payload Optional
manager_email_address string Employee Manager Email Address Payload Optional
custom_field_1 string Custom Field 1 Payload Optional
custom_field_2 string Custom Field 2 Payload Optional
custom_field_3 string Custom Field 3 Payload Optional
custom_field_4 string Custom Field 4 Payload Optional
custom_field_5 string Custom Field 5 Payload Optional
  • Example Request

    PUT

    https://devapi.olacabs.com/v1/api/corporate/user

    
        {
         "corp_email_id": "user_email@corporate_partners.com", (Cannot be changed)
         "name": "abc", (mandatory, size 255)
         "groups": ["B1"], (mandatory, size 255),
         "user_status": "inactive" (optional - inactive is the only allowed value)
         "employee_phone_number": "1234567890", (optional, size 20)
         "employee_cost_center": "BLR", (optional, size 64)
         "employee_code": "SD", (optional, size 64)
         "employee_base_location": "BAN", (optional, size 255)
         "employee_designation": "Soft Eng", (optional, size 64)
         "employee_band": "BA12", (optional, size 64)
         "employee_gender": "MALE", (optional, size 10)
         "manager_name": "Mr Dev", (optional, size 128)
         "manager_email_address": "abcd@corporate_partners.com",(optional, size 150)
         "custom_field_1": null, (optional, size 64)
         "custom_field_2": null, (optional, size 64)
         "custom_field_3": null, (optional, size 64)
         "custom_field_4": null, (optional, size 255)
         "custom_field_5": null, (optional, size 255)
        }
    
        Headers: {
          X-CORPORATE-TOKEN: fd5d4d3726121212f12ff12f12f1f12f1f12fa
        }
    
    

    Example Response (Success)

      200 - User is updated
    

    Example Responses (Failures)

    • User with email doesn't exist

        404 - User with given <user_email_id> not found
      
    • Unauthorized to update user

        401 - Unauthorized to update user
      
    • Unknown error

        500 - Unknown error
      
    • Default GST not present

        406 - Please add Default GST details for the corporate first
      
    • Tag Value does not exist

        406 - (tag_Value) does not match with the uploaded Tag/Entity Names.
      
    • Default GST will apply

        201 - Note: Default GST will apply for employees with missing tag details
      
  • Example Request (PHP)

    
          <?php
          $curl = curl_init();
          $headers = array(
          "Content-Type : application/json",
          "X-CORPORATE-TOKEN : <CLIENT-SPECIFIC-TOKEN>"
          );
          $postfields = array(
          "corp_email_id" => "tom.willsy2@mailinator.com",
          "name" => "Tom willsy 2",
          "groups" => array("Default Yogesh Group"),
          "employee_phone_number" => "1234567891",
          "employee_cost_center" => "BLR",
          "employee_code" => "SD",
          "employee_base_location" => "Delhi",
          "employee_designation" => "Soft Eng",
          "employee_band" => "BA12",
          "employee_gender" => "MALE",
          "manager_name" => "Mr X",
          "manager_email_address" => "abcd@corporate_partners.com",
          "custom_field_1" => "Allahabad",
          "custom_field_2" => null,
          "custom_field_3" => null,
          "custom_field_4" => null,
          "custom_field_5" => null,
          );
          $options = array(
          CURLOPT_URL => '<HOST>/v1/api/corporate/user',
          CURLOPT_CUSTOMREQUEST => "PUT",
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_POSTFIELDS => json_encode($postfields),
          CURLOPT_RETURNTRANSFER => true
          );
          curl_setopt_array($curl, $options);
          $response = curl_exec($curl);
          $err = curl_error($curl);
          curl_close($curl);
          if ($err) {
          echo "cURL Error #:" . $err;
          } else {
          echo $response;
          }
          ?>
                

    Example Request (JAVA)

    
          import​ ​org.apache.http.HttpResponse;
          import ​org.apache.http.client.HttpClient;
          import ​org.apache.http.client.methods.HttpDelete;
          import ​org.apache.http.client.methods.HttpGet;
          import ​org.apache.http.client.methods.HttpPost;
          import ​org.apache.http.client.methods.HttpPut;
          import ​org.apache.http.entity.StringEntity;
          import ​org.apache.http.impl.client.HttpClientBuilder;
          import ​java.io.BufferedReader;
          import ​java.io.IOException;
          import ​java.io.InputStreamReader;
          ....
          private HttpResponse runUpdate() throws IOException {
          HttpClient httpClient = HttpClientBuilder.create().build();
          HttpPut request = new HttpPut("<HOST>/v1/api/corporate/user");
          StringEntity entity = new StringEntity("{\"corp_email_id\": \"test.user@mailinator.com\", " +
          " \"name\": \"Test User\", " +
          " \"groups\": [\"Default Group\"], " +
          " \"employee_phone_number\": \"1234567890\"}");
          request.addHeader("X-CORPORATE-TOKEN","<CLIENT-SPECIFIC-TOKEN>");
          request.addHeader("Content-Type", "application/json");
          request.setEntity(entity);
          HttpResponse response = httpClient.execute(request);
          return response;
          }
                
  • Please Note:

    • For BASE LOCATION field, only the following values are allowed:-
      {agra, ahmedabad, ahmednagar, ajmer, aligarh, allahabad, ambala, amravati, amritsar, aurangabad, ballari, bangalore, bareilly, BARIELLY, belagavi, BENGALURU, bhavnagar, bhiwadi, bhopal, BHUBANESHWAR, bhubaneswar, bikaner, bokaro, chandigarh, chennai, Cochin, coimbatore, cuttack, davangere, dehradun, delhi, dhanbad, dibrugarha, dindigul, DOMBIVLI (EAST), durg bhilai, durgapur, faridabad, gaya, ghaziabad, goa, guntur, GURGAON, guwahati, gwalior, haridwar, hosur, hubli dharwad, hyderabad, indore, jabalpur, jaipur, jalandhar, jamnagar, jamshedpur, jhansi, jodhpur, kalaburagi, kanpur, kochi, kolhapur, kolkata, kota, kumbakonam, kurukshetra, lucknow, ludhiana, madurai, mangalore, MARGAO, mathura, meerut, moradabad, mumbai, mysore, nagpur, nalbari, nashik, noida, PANAJI, PANVEL, patiala, patna, pollachi, pondicherry, pune, raipur, rajahmundry, rajkot, ranchi, roorkee, rourkela, saharanpur, salem, secunderabad, shimla, siliguri, solapur, srinagar, surat, THANE, THANE (W), THANE (WEST), thanjavur, thiruvananthapuram, TIRUCHIRAPALLI, tiruchirappally, tirunelveli, tirupati, tiruppur, tuticorin, udaipur, ujjain, vadodara, varanasi, VASHI, Verna, vijayawada, visakhapatnam, warangal}

    • **Any other values used for base location field will lead to error.**