Add/Update Users (BULK)


POST /v1/api/corporate/users

Use this Api to add or edit users in bulk.

Maximum number of users per API call: 100


Request Parameters

Name Data Type Description Type Remark
corp_email_id string Employee Email Address Payload Mandatory
name string Employee Name Payload Mandatory
groups list of strings Employee Groups Payload Mandatory
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

    POST

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

    
        [
          {
           "corp_email_id": "user1_email@corporate_partners.com", (mandatory, size 255)
           "name": "abc", (mandatory, size 255)
           "groups": ["B1"], (mandatory, size 255)
           "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)
         },
         {
          "corp_email_id": "user2_email@corporate_partners.com", (mandatory, size 255)
          "name": "Nikhil Bohara", (mandatory, size 255)
          "groups": ["B2"], (mandatory, size 255)
          "employee_phone_number": "1234567990", (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)

    
        {
          "users_added": [ "user_email@corporate_partners.com" ],
          "users_updated": [ "rakesh@corporate_partners.com" ],
          "failure_list": [ "test@corporate_partners.com" ]
        }
    

    Example Responses (Failures)

    • Users not added/updated

        422 - All Add/Update Operations Failed
      
    • Unauthorised to add user

        401 - Unauthorised to add user
      
    • Unknown error

        500 - Unknown error
      
  • Example Request (PHP)

    
          <?php
          $curl = curl_init();
          curl_setopt_array($curl, array(
          CURLOPT_URL => "<HOST>/v1/api/corporate/users",
          CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => ""[{\"corp_email_id\": \"user_email@corporate_partners.com\", \"name\": \"abc\",\"groups\": [\"B1\"], \"employee_phone_number\": \"1234567890\",\"employee_cost_center\":
          \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BAN\",\"employee_designation\": \"Soft Eng\",
          \"employee_band\": \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\", \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\":
          null, \"custom_field_4\": null, \"custom_field_5\": null},{\"corp_email_id\": \"rakesh@corporate_partners.com\",\"name\": \"Rakesh\", \"groups\": [\"test123\"],\"employee_phone_number\": \"9902058917\",\"employee_cost_center\":
          \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BANGALORE\",\"employee_designation\": \"Soft Eng\", \"employee_band\": \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\",
          \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\": null, \"custom_field_4\": null, \"custom_field_5\": null},{\"corp_email_id\": \"test@corporate_partners.com\",\"name\": null, \"groups\":
          [\"test123\"],\"employee_phone_number\": \"9902058917\",\"employee_cost_center\": \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BANGALORE\",\"employee_designation\": \"Soft Eng\", \"employee_band\":
          \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\", \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\": null, \"custom_field_4\": null,
          \"custom_field_5\": null}]"",
          CURLOPT_HTTPHEADER => array(
          "cache-control: no-cache", "content-type: application/json",
          "x-app-client-id: <CLIENT-SPECIFIC-TOKEN>" ),
          ));
          $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 runPost() throws IOException {
          HttpClient httpClient = HttpClientBuilder.create().build();
          HttpPost request = new HttpPost("<HOST>/v1/api/corporate/users");
          StringEntity entity = new StringEntity("[{\"corp_email_id\": \"user_email@corporate_partners.com\", \"name\": \"abc
          \",\"groups\": [\"B1\"], \"employee_phone_number\": \"1234567890\",\"employee_cost_center\": \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BAN\",\"employee_designation\": \"Soft Eng\",
          \"employee_band\": \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\", \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\":
          null, \"custom_field_4\": null, \"custom_field_5\": null},{\"corp_email_id\": \"rakesh@corporate_partners.com\",\"name\": \"Rakesh\", \"groups\": [\"test123\"],\"employee_phone_number\": \"9902058917\",\"employee_cost_center\":
          \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BANGALORE\",\"employee_designation\": \"Soft Eng\", \"employee_band\": \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\",
          \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\": null, \"custom_field_4\": null, \"custom_field_5\": null},{\"corp_email_id\": \"test@corporate_partners.com\",\"name\": null, \"groups\":
          [\"test123\"],\"employee_phone_number\": \"9902058917\",\"employee_cost_center\": \"BLR\",\"employee_code\": \"SD\",\"employee_base_location\": \"BANGALORE\",\"employee_designation\": \"Soft Eng\", \"employee_band\":
          \"BA12\",\"employee_gender\": \"MALE\",\"manager_name\": \"Mr Dev\", \"manager_email_address\": \"abcd@corporate_partners.com\",\"custom_field_1\": null, \"custom_field_2\": null, \"custom_field_3\": null, \"custom_field_4\": null,
          \"custom_field_5\": null}]");
          request.addHeader("X-CORPORATE-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.**