With the rename and delete operations for images this episode will conclude the blog series introducing the FSI Server OpenAPI. The final two operations that will be introduced are deleting an image from the FSI Server and renaming or moving an image.
Deleting is simply performed by sending an HTTP DELETE request to the image URI introduced in part III. The Java code using the Jersey client library and presuming the client application has successfully logged in consist of the following two lines:
WebResource imageResource = client.resource(serviceURL + "image/path/to/image.jpg");
ActionResponse response = imageResource.delete(ActionResponse.class);
Just like renaming directories, renaming or moving images is performed using a POST request. The request must be directed at the image URI and must contain a form parameter named “to” which specifies the target directory and filename:
WebResource sourceImageResource = client.resource(serviceURL + "service/image/path/to/source/image.jpg");
Form form = new Form();
ActionResponse reponse = sourceImageResource.post(ActionResponse.class, form);
This completes the operations the OpenAPI offers to authenticate a client application and to manage images and directories on the server. Developers should now be able to easily write client application using the example code given in this series of blog posts. All essential operations were covered but of course the OpenAPI provides a few more commands over the REST-like interface such as changing the password or triggering a reimport of images and the advanced and highly customizable info- and list-requests offers a lot more to explore. More details can be found in the FSI Server manual and the OpenAPI manual available in the support area.