Created
September 3, 2016 07:55
-
-
Save chathurawidanage/855521ecb8c0251c5380abcb365a4570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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