App42 Cloud API

Java and Groovy Cloud SDK

Gallery

Create Photo Gallery on the cloud. This service allows to manage i.e. create, retrieve and remove albums on the cloud. Its useful for Mobile/Device App and Web App developer who want Photo Gallery functionality. It gives them a complete Photo Gallery out of the box and reduces the footprint on the device. Developers can focus on how the Photo Gallery will be rendered and this Cloud API will manage the Gallery on the cloud thereby reducing development time.Functions available under Gallery API are

In order to use the various functions available under a particular API, a developer will have to create an instance of ServiceAPI by passing the apiKey and the secretKey which has been received while creating an app.

	ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>");       

After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of AlbumService, buildAlbumService() method needs to be called.

	
							AlbumService albumService = api.buildAlbumService();

Once the API instance has been retrieved, You are ready to use the functions available for that particular API.

The methods available under a particular API will return the domain object (like Album in this case) as a response which will have the accessor / mutator to access the available properties for that object. You can get the response in the form of JSON as well. We have provided the JSON response with every function detail which can be retrieved by calling the toString() on the returned object.

String userName = "Nick";
String albumName = "MyAlbum";
String albumDescription = "Album Description";	
					
Album album = albumService.createAlbum(userName,albumName,albumDescription);  /* returns the Album object. */ 
System.out.println("userName is " + album.getUserName());
System.out.println("albumName is " + album.getName());
System.out.println("albumDescription is " + album.getDescription());
String jsonResponse = album.toString(); /* returns the response in JSON format. */    

The functions available under Gallery API can throw some exceptions in abnormal conditions. Example of the same has been given below.

E.g. If App developer is creating an album for the user which is not in database, the function will throw the App42Exception (as shown below) with message as "Bad Request" and the appErrorCode as "2500" and the details as "The request parameters are invalid. Album with the name '<albumName>' for the user '<userName>' already exists".

String userName = "Nick";
String albumName = "MyAlbum";
String albumDescription = "Album Description";	

try
{
	Album album = albumService.createAlbum(userName,albumName,albumDescription);
} 
catch(App42Exception ex)
{
	int appErrorCode = ex.getAppErrorCode();
	int httpErrorCode = ex.getHttpErrorCode();
	if(appErrorCode == 2500)
	{
		// Handle here for Bad Request (The request parameters are invalid. Album with the name '<albumName>' for the user '<userName>' already exists.)
	}
	else if(appErrorCode == 1401){
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500){
		// handle here for Internal Server Error
	}
	String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/	
}                           
	{
		"app42Fault": {
			"httpErrorCode": 404,
			"appErrorCode": 2500,
			"message": "Bad Request",
			"details": "The request parameters are invalid. Album with the name 'MyAlbum' for the user 'Nick' already exists"
		}
	}		

Below are the HTTP Error Codes and their description, the function under the Gallery API can throw.

/*
1400 - BAD REQUEST - The Request parameters are invalid
1401 - UNAUTHORIZED - Client is not authorized
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again	
*/						

Below are the Application Error Codes and their description, the function under the Gallery API can throw.

/*
2500 - BAD REQUEST - The request parameters are invalid. Album with the name '<albumName>' for the user '<userName>' already exists.
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2502 - NOT FOUND - Albums for the user '<userName>' do not exist.
2503 - NOT FOUND - Albums and Photos for the user '<userName>' does not exist.
2504 - NOT FOUND - Photo with the name '<photoName>' from the album '<albumName>' for the user '<userName>' does not exist.
2505 - BAD REQUEST - The request parameters are invalid. Photo by the name '<photoName>' for album '<albumName>' for the user '<userName>' already exists.
2506 - NOT FOUND - The number of albums for the user '<userName>' are less than the specified offset : <offset>.
2507 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' have less photos than the specified offset : <offset>.
2508 - NOT FOUND -Albums and Photos for the tag '<tag>' does not exist.
*/						

Various functions available under Gallery API has been explained below.

public Album createAlbum(String userName, String albumName, String albumDescription) throws App42Exception

Creates Album on the cloud.

Parameters:

userName - The user to which the album belongs.
albumName - Name of the album to be created on the cloud.
albumDescription - Description of the album to be created

Returns:

Album object containing the album which has been created

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2500 - BAD REQUEST - The request parameters are invalid. Album with the name '<albumName>' for the user '<userName>' already exists.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String albumDescription = "Album Description";	
					
Album album = albumService.createAlbum(userName,albumName,albumDescription);  /* returns the Album object. */ 
System.out.println("userName is " + album.getUserName());
System.out.println("albumName is " + album.getName());
System.out.println("albumDescription is " + album.getDescription());
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description"
                }
            }
        }
    }
}
public ArrayList<Album> getAlbums(String userName) throws App42Exception

Fetches all the Albums based on the userName

Parameters:

userName - The user for which the albums have to be fetched

Returns:

List of Album object containing all the album for the given userName

Response: ArrayList<Album> Object

Exception:

The method throws the following exception with the error code.
/*
2502 - NOT FOUND - Albums for the user '<userName>' do not exist.
*/		        
For more details click Exception
String userName = "Nick";
						
ArrayList<Album> albumList = albumService.getAlbums(userName); /* returns the list of Album objects. */
for(Album album : albumList)
{
	System.out.println("userName is " + album.getUserName());
	System.out.println("albumName is " + album.getName());
	System.out.println("albumDescription is " + album.getDescription()); 
}
String jsonResponse = albumList.toString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": [
                    {
                        "userName": "Nick",
                        "name": "MyAlbum",
                        "description": "Album Description"
                    },
                    {
                        "userName": "Nick",
                        "name": "Album091",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
}
public App42Response getAlbumsCount(String userName) throws App42Exception

Fetches the count of all the Albums based on the userName

Parameters:

userName - The user for which the count of albums have to be fetched

Returns:

App42Response object containing the count of all the album for the given userName

Response: App42Response Object

For more details click Exception
String userName = "Nick";
						
App42Response response = albumService.getAlbumsCount(userName); /* returns the App42Response objects. */
boolean  success = response.isResponseSuccess();
int totalRecords = response.getTotalRecords();
String jsonResponse = response.toString(); /* returns the response in JSON format. (as shown below)*/  
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
public ArrayList<Album> getAlbums(String userName, int max, int offset) throws App42Exception

Fetches all the Albums based on the userName by Paging.

Parameters:

userName - The user for which the albums have to be fetched
max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

List of Album object containing all the album for the given userName

Response: ArrayList<Album> Object

Exception:

The method throws the following exception with the error code.
/*
2506 - NOT FOUND - The number of albums for the user '<userName>' are less than the specified offset : <offset>.
*/		        
For more details click Exception
String userName = "Nick";
int max = 1;
int offset = 0;
						
ArrayList<Album> albumList = albumService.getAlbums(userName,max,offset); /* returns the list of Album objects. */
for(Album album : albumList)
{
   	System.out.println("userName is " + album.getUserName());
	System.out.println("albumName is " + album.getName());
	System.out.println("albumDescription is " + album.getDescription());
}
String jsonResponse = albumList.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": [
                    {
                        "userName": "Nick",
                        "name": "MyAlbum",
                        "description": "Album Description"
                    },
                    {
                        "userName": "Nick",
                        "name": "Partyalbum",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
}
public Album getAlbumByName(String userName, String albumName) throws App42Exception

Fetch all Album based on the userName and albumName.

Parameters:

userName - The user for which the album has to be fetched
albumName - Name of the album that has to be fetched

Returns:

Album object containing album for the given userName and albumName

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
*/		       
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";					

Album album = albumService.getAlbumByName(userName,albumName);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
System.out.println("albumDescription is " + album.getDescription());
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description"
                }
            }
        }
    }
}
public App42Response removeAlbum(String userName, String albumName)throws App42Exception

Removes the album based on the userName and albumName.
Note: All photos added to this Album will also be removed.

Parameters:

userName - The user for which the album has to be removed
albumName - Name of the album that has to be removed

Returns:

App42Response if removed successfully

Response: App42Response Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
*/		       
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";						

App42Response response = albumService.removeAlbum(userName, albumName); /* returns the App42Response object. */
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "Photo091",
                            "description": "Photo Details",
                            "url": "http://XXXX.png",
                            "thumbNailUrl": null
                        }
                    }
                }
            }
        }
    }
}
public Album addPhoto(String userName, String albumName, String photoName, String photoDescription, String path) throws App42Exception

Adds Photo for a particular user and album. The Photo is uploaded on the cloud.

Parameters:

userName - Name of the User whose photo has to be added
albumName - Name of the Album in which photo has to be added
photoName - Name of the Photo that has to be added
photoDescription - Description of the Photo that has to be added
path - Path from where Photo has to be picked for addition

Returns:

Album object containing the Photo which has been added.

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2505 - BAD REQUEST - The request parameters are invalid. Photo by the name '<photoName>' for album '<albumName>' for the user '<userName>' already exists.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String photoName = "Photo091";
String photoDescription = "Photo Details";
String path	= "Local file path";					

Album album = photoService.addPhoto(userName,albumName,photoName,photoDescription,path);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
System.out.println("description is " + album.getDescription());
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
    System.out.println("name is " + photo.getName());
	System.out.println("description is " + photo.getDescription());
}
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "Photo091",
                            "description": "Photo Details",
                            "url": "http://XXXX.png",
                            "thumbNailUrl": "http://XXXX-thumbnail.png"
                        }
                    }
                }
            }
        }
    }
}
public Album addPhoto(String userName, String albumName, String photoName, String photoDescription, InputStream inputStream) throws App42Exception

Adds Photo for a particular user and album via Stream. The Photo is uploaded on the cloud.

Parameters:

userName - Name of the User whose photo has to be added
albumName - Name of the Album in which photo has to be added
photoName - Name of the Photo that has to be added
photoDescription - Description of the Photo that has to be added
inputStream - Input Stream for the Photo that has to be added

Returns:

Album object containing the Photo which has been added

Response: Album Object

For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String photoName = "Photo091";
String photoDescription = "Photo Details";
String imagePath = "Local file path";					
FileInputStream fileInputStream = null;

try 
{
	fileInputStream = new FileInputStream(imagePath);
}
catch (FileNotFoundException e) 
{
	e.printStackTrace();
}
Album album = photoService.addPhoto(userName,albumName,photoName,photoDescription,fileInputStream);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
System.out.println("description is " + album.getDescription());
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
	System.out.println("name is " + photo.getName());
	System.out.println("description is " + photo.getDescription());
}
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "Photo091",
                            "description": "Photo Details",
                            "url": "http://XXXX.png",
                            "thumbNailUrl": "http://XXXX-thumbnail.png"
							"thumbNailTinyUrl": "http://tinyurl.com/XXXX"
                        }
                    }
                }
            }
        }
    }
}
public Album addTagToPhoto(String userName, String albumName, String photoName, ArrayList<String> tagList) throws App42Exception

Add tags to the Photo for the user in the album.

Parameters:

userName - Name of the User whose name has to be tagged to photo
albumName - Album name whose photo is to be tagged
photoName - Photo name to be tagged
tagList - List of tags in Photo

Returns:

Album object containing the Photo which has been added

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2504 - NOT FOUND - Photo with the name '<photoName>' from the album '<albumName>' for the user '<userName>' does not exist.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String photoName = "PhotoName_01";
ArrayList<String> tagList = new ArrayList<String>();					
tagList.add("John");	

Album album = photoService.addTagToPhoto(userName,albumName,photoName,taglist);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName()); 
System.out.println("description is " + album.getDescription()); 
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
    System.out.println("name is " + photo.getName());
	System.out.println("description is " + photo.getDescription());
    System.out.println("taglist is " + photo.getTagList());
}
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": " MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "PhotoName_01.png",
                            "description": "Photo DESC",
                            "url": "http://XXXX.png",
                            "tinyUrl": "http://tinyurl.com/XXXX",
                            "thumbNailUrl": "http://XXXX-thumbnail.png",
                            "thumbNailTinyUrl": "http://tinyurl.com/XXXX",
                            "tags": "TagName_01"
                        }
                    }
                }
            }
        }
    }
}
public ArrayList<Album> getPhotos(String userName) throws App42Exception

Fetches all the Photos based on the userName.

Parameters:

userName - Name of the User whose photos have to be fetched

Returns:

List of Album object containing all the Photos for the given userName

Response: ArrayList<Album> Object

Exception:

The method throws the following exception with the error code.
/*
2503 - NOT FOUND - Albums and Photos for the user '<userName>' does not exist.
*/		        
For more details click Exception
String userName = "Nick";
						
ArrayList<Album> albumList = photoService.getPhotos(userName); /* returns the list of Album objects. */
for(Album album : albumList)
{
	System.out.println("albumName is " + album.getName());
	System.out.println("userName is " + album.getUserName());
	System.out.println("description is " + album.getDescription());
	ArrayList<Album.Photo> photoList = album.getPhotoList();
	for(Album.Photo photo : photoList)
	{  
		System.out.println("name is " + Photo.getName());
		System.out.println("description is " + Photo.getDescription());
	}
}
String jsonResponse = albumList.toString (); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": [
                    {
                        "userName": "Nick",
                        "name": "MyAlbum",
                        "description": "Album Description",
                        "photos": {
                            "photo": [
                                {
                                    "name": "Photo090",
                                    "description": "Photo Description",
                                    "url": "http://XXXX.jpg",
                                    "thumbNailUrl": "http://XXXX-thumbnail.jpg"
                                },
                                {
                                    "name": "Photo091",
                                    "description": "Photo Details",
                                    "url": "http://YYYY.png",
                                    "thumbNailUrl": "http://YYYY-thumbnail.png"
                                }
                            ]
                        }
                    },
                    {
                        "userName": "Jack",
                        "name": "Album091",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
}
public ArrayList<Album> getTaggedPhotos(String userName, String tag) throws App42Exception

Fetches all the Photos based on the userName and tag

Parameters:

userName - Name of the User whose photos have to be fetched
tag - Tag on which basis photos have to be fetched

Returns:

List of Album object containing all the Photos for the given userName

Response: ArrayList<Album> Object

Exception:

The method throws the following exception with the error code.
/*
2503 - NOT FOUND - Albums and Photos for the user '<userName>' does not exist.
2508 - NOT FOUND -Albums and Photos for the tag '<tag>' does not exist.
*/		        
For more details click Exception
String userName = "Nick";
String tag = "joy";
						
ArrayList<Album> albumList = photoService.getTaggedPhotos(userName,tag); /* returns the list of Album objects. */
for(Album album : albumList)
{
	System.out.println("albumName is " + album.getName());
	System.out.println("userName is " + album.getUserName());
	System.out.println("description is " + album.getDescription());
	ArrayList<Album.Photo> photoList = album.getPhotoList();
	for(Album.Photo photo : photoList)
	{  
		System.out.println("name is " + photo.getName());
		System.out.println("description is " + photo.getDescription());
		ArrayList<String> tagList = photo.getTagList();
	}
}
String jsonResponse = albumList.toString(); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "MyAlbum description",
                    "photos": {
                        "photo": {
                            "name": "myPhoto",
                            "description": "photo at Tour",
                            "url": "http://XXXX.jpg",
                            "tinyUrl": "http://tinyurl.com/XXXX",
                            "thumbNailTinyUrl": "http://tinyurl.com/XXXX",
                            "thumbNailUrl": "http://XXXX-thumbnail.jpg",
                            "tags": "joy"
                        }
                    }
                }
            }
        }
    }
}
public Album getPhotosByAlbumName(String userName, String albumName) throws App42Exception

Fetches all Photos based on the userName and album name.

Parameters:

userName - Name of the User whose photos have to be fetched
albumName - Name of the Album from which photos have to be fetched

Returns:

Album object containing all the Photos for the given userName and albumName

Response: Album Object

Exception:

The method throws the following exception with the error code.
/* 
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";						

Album album = photoService.getPhotosByAlbumName(userName,albumName);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
String albumDescription = album.getDescription(); 
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
    String name = photo.getName();
    String description = photo.getDescription();
}
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": [
                            {
                                "name": "Photo090",
                                "description": "Photo Description",
                                "url": "http://XXXX.jpg",
                                "thumbNailUrl": "http://XXXX-thumbnail.jpg"
                            },
                            {
                                "name": "Photo091",
                                "description": "Photo Details",
                                "url": "http://YYYY.png",
                                "thumbNailUrl": "http://YYYY-thumbnail.png"
                            }
                        ]
                    }
                }
            }
        }
    }
}
public App42Response getPhotosCountByAlbumName(String userName, String albumName) throws App42Exception

Fetches the count of all Photos based on the userName and album name

Parameters:

userName - Name of the User whose count of photos have to be fetched
albumName - Name of the Album from which count of photos have to be fetched

Returns:

App42Response object containing the count of all the Photos for the given userName and albumName

Response: App42Response Object

For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";					

App42Response response = photoService.getPhotosCountByAlbumName(userName,albumName); /* returns the App42Response objects. */
boolean  success = response.isResponseSuccess();
int totalRecords = response.getTotalRecords();
String jsonResponse = response.toString(); /* returns the response in JSON format. (as shown below)*/    
{
   "app42": {
       "response": {
           "success": true,
           "totalRecords": 3
       }
   }
}
public Album getPhotosByAlbumName(String userName, String albumName, int max, int offset) throws App42Exception

Fetches all Photos based on the userName and album name by paging.

Parameters:

userName - Name of the User whose photos have to be fetched
albumName - Name of the Album from which photos have to be fetched
max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Album object containing all the Photos for the given userName and albumName

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2507 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' have less photos than the specified offset : <offset>.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
int max = 1;
int offset = 0;

Album album = photoService.getPhotosByAlbumName(userName,albumName,max,offset);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
System.out.println("albumDescription is " + album.getDescription());
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
  	System.out.println("name is " + photo.getName());
	System.out.println("description is " + photo.getDescription());
}
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/    
{
   "app42": {
       "response": {
           "success": true,
           "albums": {
               "album": {
                   "userName": "Nick",
                   "name": "MyAlbum",
                   "description": "Album Description",
                   "photos": {
                       "photo": {
                           "name": "photoName1",
                           "description": "welcome",
                           "url": "http://XXXX.jpg",
                           "thumbNailUrl": "http://XXXX-thumbnail.jpg"
                       }
                   }
               }
           }
       }
   }
}
public Album getPhotosByAlbumAndPhotoName(String userName, String albumName, String photoName) throws App42Exception

Fetches the particular photo based on the userName, album name and photo name.

Parameters:

userName - Name of the User whose photo has to be fetched
albumName - Name of the Album from which photo has to be fetched
photoName - Name of the Photo that has to be fetched

Returns:

Album object containing the Photo for the given userName, albumName and photoName

Response: Album Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2504 - NOT FOUND - Photo with the name '<photoName>' from the album '<albumName>' for the user '<userName>' does not exist.
*/		        
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String photoName = "Photo091";
						
Album album = photoService.getPhotosByAlbumAndPhotoName(userName,albumName,photoName);  /* returns the Album object. */ 
System.out.println("albumName is " + album.getName());
System.out.println("userName is " + album.getUserName());
String albumDescription = album.getDescription();  
ArrayList<Album.Photo> photoList = album.getPhotoList();
for(Album.Photo photo : photoList)
{  
    System.out.println("name is " + photo.getName());
	System.out.println("description is " + photo.getDescription());
}	
String jsonResponse = album.toString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "Photo091",
                            "description": "Photo Details",
                            "url": "http://XXXX.png",
                            "thumbNailUrl": "http://XXXX.png"
                        }
                    }
                }
            }
        }
    }
}
public App42Response removePhoto(String userName, String albumName, String photoName) throws App42Exception

Removes the particular Photo from the specified Album for a particular user.
Note: The Photo is removed from the cloud and wont be accessible in future

Parameters:

userName - Name of the User whose photo has to be removed
albumName - Name of the Album in which photo has to be removed
photoName - Name of the Photo that has to be removed

Returns:

App42Response if removed successfully

Response: App42Response Object

Exception:

The method throws the following exception with the error code.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
2504 - NOT FOUND - Photo with the name '<photoName>' from the album '<albumName>' for the user '<userName>' does not exist.
*/		       
For more details click Exception
String userName = "Nick";
String albumName = "MyAlbum";
String photoName = "Album Description";						

App42Response response = photoService.removePhoto(userName, albumName, photoName); /* returns the App42Response object. */
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "albums": {
                "album": {
                    "userName": "Nick",
                    "name": "MyAlbum",
                    "description": "Album Description",
                    "photos": {
                        "photo": {
                            "name": "Photo090",
                            "description": "Photo Description",
                            "url": "http://XXXX.jpg",
                            "thumbNailUrl": "http://XXXX.jpg"
                        }
                    }
                }
            }
        }
    }
}