Get Users


GET /v1/api/corporate/users?status=<status>&limit=<limit>&offset=<offset>

Use this Api to get list of users of a corporate.


Request Parameters

Name Data Type Description Type Remark
status string Employee Status query Optional
offset integer Offset query Optional
limit integer No of users to fetch query Optional
  • Example Request

    GET

    https://devapi.olacabs.com/v1/api/corporate/users?status=<status>&limit=<limit>&offset=<offset>

    
        Headers: {
          X-CORPORATE-TOKEN: fd5d4d3726121212f12ff12f12f1f12f1f12fa
        }
    
    

    Example Response (Success)

      200
        [
          {
            "employee_gender": "MALE", "user_type": "user", "custom_field1": "Allahabad", "custom_field3": null, "custom_field2": null, "name": "Tom willsy", "custom_field5": null, "custom_field4": null, "phone_number": "1234567890", "email": "tom.willsy@mailinator.com", "status": "pending", "employee_code": "SD"
          },
          {
            "employee_gender": "MALE", "user_type": "user", "custom_field1": "Allahabad", "custom_field3": null, "custom_field2": null, "name": "Tom willsy 2", "custom_field5": "abcdefghijkl", "custom_field4": null, "phone_number": "1234567891", "email": "tom.willsy2@mailinator.com", "status": "inactive", "employee_code": "SD"
          }
        ]
    
    

    Example Responses (Failures)

    • Unknown error

        500 - Unknown error
      
  • Example Request (PHP)

    
          <?php
          $curl = curl_init();
          $headers = array("X-CORPORATE-TOKEN: <CLIENT-SPECIFIC-TOKEN>");
          $options = array(
          CURLOPT_URL => '<HOST>/v1/api/corporate/users?limit=100',
          CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_HTTPHEADER => $headers,
          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 runGet() throws IOException {
          HttpClient httpClient = HttpClientBuilder.create().build();
          HttpGet request = new HttpGet("<HOST>/v1/api/corporate/users?status=inactive");
          request.addHeader("X-CORPORATE-TOKEN","<CLIENT-SPECIFIC-TOKEN>");
          request.addHeader("Content-Type", "application/json");
          HttpResponse response = httpClient.execute(request);
          BufferedReader reader = new BufferedReader(new InputStreamReader(
          response.getEntity().getContent()));
          String inputLine;
          StringBuffer responseEntity = new StringBuffer();
          while ((inputLine = reader.readLine()) != null) {
          responseEntity.append(inputLine);
          }
          System.out.println(responseEntity.toString());
          reader.close();
          return response;
          }