Skip to content

Instantly share code, notes, and snippets.

@chathurawidanage
Created September 3, 2016 07:55
Show Gist options
  • Save chathurawidanage/855521ecb8c0251c5380abcb365a4570 to your computer and use it in GitHub Desktop.
Save chathurawidanage/855521ecb8c0251c5380abcb365a4570 to your computer and use it in GitHub Desktop.
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.impl.client.HttpClientBuilder;
import java.io.IOException;
/**
* @author Chathura Widanage
*/
public class TestDNMS {
public static void main(String[] args) throws IOException {
HttpClient httpClient= HttpClientBuilder.create().build();
HttpDelete del=new HttpDelete("SERVER_URL/api/trackedEntityInstances/HuCzn3kHqyL");
del.setHeader("Authorization","Basic {AUTH}");
HttpResponse delResponse = httpClient.execute(del);
int delStatusCode=delResponse.getStatusLine().getStatusCode();
System.out.println(delStatusCode);
if(delStatusCode==204){
System.out.println("tei deleted");
}else{
System.out.println("tei not deleted");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment