Jul 11, 2013

Use CURL to test POST RESTful API

I was working one specific task about RESTful API and it took me sometime, and after finish it I think it's worth sharing.

The task is: I need to implement a POST RESTful API, which accepts multiple parameters. And I will make it be able to call by a C++ or shell script.

The API looks like this, and in JAVA codes:


@POST
@Path("updatecache")
public void postCache(@QueryParam("instanceID") String instanceID, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime) {
        /*The implementation details are hidden herer*/
}

To test it in POSTMAN

To test it in CURL, it took me really a long time, and

curl -H "user:abc" -H "password:abc" -X POST "http://localhost:8080/dsm/resources/heatmap/updatecache?instanceID=96&startTime=2013-06-29%2000:00:00&endTime=2013-07-02%2010:00:00"

Note: the URL should be double quoted. Because Typing & in the command line means run the preceding command in the background , because of this anything after the & is being treated as a new command.

If you think this article is useful, please click the ads on this page to help. Thank you very much.

Jul 4, 2013

Windows 7 Free Partition Tool - EaseUS Partition Master Edition

I have been using Norton Partition Magic since Windows XP era, but on Windows 7 it doesn't work very well. Fortunately there is a good tool which can well replace partition magic for Win7, and the name is:


EaseUS Partition Master Home EditionEaseUS Partition Master Free Edition

You can download it here here or here

For normal users, the free edition is good enough. The features I used most are: 
  • Resize/Move partitions to avoid data loss, like extending NTFS system partition without reboot to maximize PC performance
  • Create multiple-partitions, delete partition
  • Safely merge two adjacent partitions into a bigger one without data loss.
If you find this article useful, please kindly click the ads on this page to help. Thank you.