Delete User


DELETE /v1/api/corporate/user?corp_email_id=<user_email_id>

Use this Api to delete an existing user from a corporate.


Request Parameters

Name Data Type Description Type Remark
corp_email_id string Employee Email Address query Mandatory
  • Example Request

    DELETE

    https://devapi.olacabs.com/v1/api/corporate/user?corp_email_id=<user_email_id>

    
        Headers: {
          X-CORPORATE-TOKEN: fd5d4d3726121212f12ff12f12f1f12f1f12fa
        }
    
    

    Example Response (Success)

      200 - User is deleted
    

    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
      
  • Example Request (PHP)

    
          <?php
          $curl = curl_init(); $headers = array("X-CORPORATE-TOKEN: <CLIENT-SPECIFIC-TOKEN>"); $options = array(
          CURLOPT_URL => '<HOST>/v1/api/corporate/user?corp_email_id=tom.willsy2@mailinator.com', CURLOPT_CUSTOMREQUEST => "DELETE", 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;
          ....
          public HttpResponse runDelete() throws IOException {
          HttpClient httpClient = HttpClientBuilder.create().build();
          HttpDelete request = new
          HttpDelete("<HOST>/v1/api/corporate/user?corp_email_id=test.user@mailinator.com");
          request.addHeader("X-CORPORATE-TOKEN","<CLIENT-SPECIFIC-TOKEN>");
          HttpResponse response = httpClient.execute(request);
          return response;
          }