ATS : HTTP Operations - List of supported HTTP methods

Following is a list with currently supported HTTP methods

 


GET method

GET is used to retrieve an already existing resource on the server without modifying it

// execute a GET method
HttpResponse response = client.get();

// now examine the response 

 


POST method

POST is used to create a new resource on the server

// set the body to post by using one of the supported methods
// set the request content type as well
client.setRequestBody( new File( <path to a local file> ), "text/xml" );

// execute a POST
HttpResponse response = client.post();

// now examine the response

 


PUT method

PUT is used to update an already existing resource on the server.

You can use the POST method as example, but call the put method instead.

 


DELETE method

DELETE is used to delete an already existing resource on the server

// make an instance of the HTTP client by specifying the target URI
HttpClient client = new HttpClient( <target URI>/people/delete/123 );

// execute a DELETE method
HttpResponse response = client.delete();

// now examine the response

In this example we delete a person with id 123 which is specified as part of the URI.

Of course there are different ways of pointing the resource to delete, for example you can use a request parameter.

 


Back to parent page

Go to Table of Contents