2

i am creating this request but it is working as get method not like delete

 `public static void main(String[] args)  {     
    OkHttpClient client = new OkHttpClient();
    try {
    Request request = new Request.Builder()
      .url("https://qa.ecourierz.com/api/v1/bookings/ECZ159616")
      .delete()
      .addHeader("content-type", "application/x-www-form-urlencoded;charset=utf-8")
      .addHeader("x-api-token", "5dfb3ef7c11e1756916bb997-933f79708364c553a7c7352e7d2a6824cd48d8ed")
      .addHeader("cache-control", "no-cache")
      .build();
        Response response = client.newCall(request).execute();
        String body = response.body().string();
        System.out.println("body  "+body);
        System.out.println( "response---------------------    "+ response);
    } catch (IOException e) {
        System.out.println("hello");
        e.printStackTrace();
    }
Ashish
  • 31
  • 2
  • i am creating this code for httpdelete request.i am getting response code as 200 but it is working like get request as the order status is not getting changed in response please help – Ashish Dec 31 '19 at 06:26
  • I am getting the result `{"status": "error", "errors": [{"status_code": 401, "error_code": "", "location": "header", "name": "X-API-Token", "description": "Kindly verify your X-API-Token. No User exists with the provided Token"}]}` – Vishwa Ratna Dec 31 '19 at 06:43
  • using this X-API-Token 5dfb3ef7c11e1756916bb997-933f79708364c553a7c7352e7d2a6824cd48d8ed and the above url hit using postman the response is comming – Ashish Dec 31 '19 at 06:49
  • **"description": "Kindly verify your X-API-Token. No User exists with the provided Token"** – Vishwa Ratna Dec 31 '19 at 07:00

0 Answers0