Code example for HttpDelete

Methods: setHeader

        // Create client and set our specific user-agent string 
        HttpClient client = CreateClient(); uri = URI.create(url);
        HttpHost host = GetHost(uri);
        HttpDelete request = new HttpDelete(uri.getPath());
        request.setHeader("User-Agent", sUserAgent);
        try { 
            HttpResponse response = client.execute(host, request);
            // Check if server response is valid 
            StatusLine status = response.getStatusLine();
            Log.i(cTag, "delete with response " + status.toString());
            return status.getStatusCode() == HttpStatus.SC_OK;
        } catch (IOException e) {
            throw new ApiException("Problem communicating with API", e);
Experience pair programming with AI  Get Codota for Java