App42 Cloud API

iOS 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 *serviceAPIObj = [[ServiceAPI alloc]init];
serviceAPIObj.apiKey = @"<API_KEY>";
serviceAPIObj.secretKey = @"<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 = [serviceAPIObj 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.

NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *albumDescription = @"Album Description";

Album *album = [albumService createAlbum:userName albumName:albumName albumDescription:albumDescription];  /* returns the Album object. */ 
NSString *albumName =  album.name; 
NSString *userName =  album.userName; 
NSString *albumDescription = album.description; 
NSString *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".

NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *albumDescription = @"Album Description";	

try
{
	Album *album = albumService.createAlbum(userName,albumName,albumDescription);
} 
catch(App42Exception *ex)
{
	int appErrorCode = ex.appErrorCode;
	int httpErrorCode = ex.httpErrorCode;
	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.reason; /* 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.

-(Album*)createAlbum:(NSString*)userName albumName:(NSString*)albumName albumDescription:(NSString*)albumDescription

Create 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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *albumDescription = @"Album Description";

Album *album = [albumService createAlbum:userName albumName:albumName albumDescription:albumDescription];  /* returns the Album object. */  
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSString *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"
                }
            }
        }
    }
} 
-(NSArray*)getAlbums:(NSString*)userName

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: NSArray

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
NSString *userName = @"Nick";

NSArray *albumList = [albumService getAlbums:userName]; /* returns the list of Album objects. */
for(Album *album in albumList)
{
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSString *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"
                    },
                    {
                        "userName": "Nick",
                        "name": "Album091",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
} 
-(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
NSString *userName = @"Nick";
						
App42Response *response = [albumService getAlbumsCount:userName]; /* returns the App42Response object. */
BOOL success = response.isResponseSuccess;
NSString *jsonResponse = [response toString]; /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
-(NSArray*)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: NSArray

Exception:

This method throws following exception.
/*
2506 - NOT FOUND - The number of albums for the user '<userName>' are less than the specified offset : <offset>.
*/		        
For more details click Exception
NSString *userName = @"Nick";
int max = 1;
int offset = 0;
						
NSArray *albumList = [albumService getAlbums:userName max:max offset:offset]; /* returns the list of Album objects. */
for(Album *album in albumList)
{
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSString *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"
                    },
                    {
                        "userName": "Nick",
                        "name": "Partyalbum",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
}
-(Album*)getAlbumByName:(NSString*)userName albumName:(NSString*)albumName

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:

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

Album *album = [albumService getAlbumByName:userName albumName:albumName];/* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description); 
NSString *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"
                }
            }
        }
    }
} 
-(App42Response*)removeAlbum:(NSString*)userName albumName:(NSString*)albumName

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:

This method throws following exception.
/*
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
*/		       
For more details click Exception
App42Response *response = [albumService removeAlbum:userName albumName:albumName];/* returns the App42Response object. */
BOOL success = response.isResponseSuccess;
NSString *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
                        }
                    }
                }
            }
        }
    }
}
-(Album*)addPhoto:(NSString*)userName albumName:(NSString*)albumName photoName:(NSString*)photoName photoDescription:(NSString*)photoDescription path:(NSString*)path

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:

This method throws following exception.
/*
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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *photoName = @"Photo091";
NSString *photoDescription = @"Photo Details";
NSString *path = @"Local file path";

Album *album = [photoService addPhoto:userName albumName:albumName photoName:photoName photoDescription:photoDescription path:path];/* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
} 
NSString *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"
                        }
                    }
                }
            }
        }
    }
}
-(Album*)addPhoto(String userName, String albumName, String photoName, String photoDescription, InputStream inputStream)

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
fileData- Data 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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *photoName = @"Photo091";
NSString *photoDescription = @"Photo Details";
NSString *path = @"Local file path"
NSData *data = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:path]];;

Album *album = [photoService addPhoto:userName albumName:albumName photoName:photoName photoDescription:photoDescription fileData:data];/* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
} 
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/bovuvoa"
                        }
                    }
                }
            }
        }
    }
}
-(Album*)addTagToPhoto(String userName, String albumName, String photoName, ArrayList<String> tagList)

Adds tag to the Photo of 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:

This method throws following exception.
/*
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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
NSString *photoName = @"PhotoName_01";
NSArray *tagList = [NSArray arrayWithObject:@"John"];					

Album *album  = [photoService addTagToPhoto:userName albumName:albumName photoName:photoName taglist:taglist]  /* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description);
NSLog(@"taglist is %@" , photo.taglist); 
} 
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/cr8z9gk",
                            "thumbNailUrl": "http://XXXX-thumbnail.png",
                            "thumbNailTinyUrl": "http://tinyurl.com/csw4mqz",
                            "tags": "TagName_01"
                        }
                    }
                }
            }
        }
    }
}
-(NSArray*)getPhotos:(NSString*)userName

Fetch 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: NSArray

Exception:

This method throws following exception.
/*
2503 - NOT FOUND - Albums and Photos for the user '<userName>' does not exist.
*/		        
For more details click Exception
NSString *userName = @"Nick";

NSArray *albumList = [photoService getPhotos:userName]; /* returns the list of Album objects. */
for(Album *album in albumList){
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
} 
}
NSString *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"
                                }
                            ]
                        }
                    },
                    {
                        "userName": "Jack",
                        "name": "Album091",
                        "description": "Album Description"
                    }
                ]
            }
        }
    }
} 
-(NSArray*)getTaggedPhotos:(NSString*)userName tag:(NSString*)tag

Fetch 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: NSArray

Exception:

This method throws following exception.
/*
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
NSString *userName = @"Nick";
NSString *tag = @"joy";	
					
NSArray *albumList =[photoService getTaggedPhotos:userName tag:tag]; /* returns the list of Album objects. */
for(Album *album in albumList)
{
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
NSString *jsonResponse = [album 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/78c4mwp",
                            "thumbNailTinyUrl": "http://tinyurl.com/7agsvc6",
                            "thumbNailUrl": "http://XXXX-thumbnail.jpg",
                            "tags": "joy"
                        }
                    }
                }
            }
        }
    }
}
-(Album*)getPhotosByAlbumName:(NSString*)userName albumName:(NSString*)albumName

Fetch 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:

This method throws following exception.
/* 
2501 - NOT FOUND - Album by the name '<albumName>' for the user '<userName>' does not exist.
*/		        
For more details click Exception
Album *album = [photoService getPhotosByAlbumName:userName albumName:albumName]; /* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
}
NSString *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"
                            }
                        ]
                    }
                }
            }
        }
    }
}
-(App42Response*)getPhotosCountByAlbumName(String userName, String albumName) throws App42Exception

Fetch 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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";					

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

Fetch 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:

This method throws following exception.
/*
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
NSString *userName = @"Nick";
NSString *albumName = @"MyAlbum";
int max = 1;
int offset = 0;

Album *album = [photoService getPhotosByAlbumName:userName albumName : albumName max :max offset:offset];  /* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description);
NSArray *photoList = album.photoList;
for(Photo *photo in photoList)
{  
NSLog(@"name  is   %@" ,  photo.name);
NSLog(@"description is %@" , photo.description); 
}
NSString *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"
                       }
                   }
               }
           }
       }
   }
}
-(Album*)getPhotosByAlbumAndPhotoName:(NSString*)userName albumName:(NSString*)albumName photoName:(NSString*)photoName

Fetch 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:

This method throws following exception.
/*
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
Album *album = [photoService  getPhotosByAlbumAndPhotoName:userName albumName:albumName photoName:photoName]; /* returns the Album object. */ 
NSLog(@"userName is  %@" , album.userName);
NSLog(@"albumName is   %@" ,  album.name);
NSLog(@"albumDescription is %@" , album.description); 
NSString *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"
                        }
                    }
                }
            }
        }
    }
}
-(App42Response*)removePhoto:(NSString*)userName albumName:(NSString*)albumName photoName:(NSString*)photoName

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

App42Response *response = [photoServiceObject removePhoto:userName albumName:albumName photoName:photoName];/* returns the App42Response object. */
BOOL success = response.isResponseSuccess;
NSString *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"
                        }
                    }
                }
            }
        }
    }
}