api for .net

Feb 7, 2011 at 12:46 PM
Edited Feb 8, 2011 at 3:44 AM

Hi ,

as i am developing an application in .net for windows form i need full api from authentication to upload photos to album , make them private etc .. waiting for the reply

regards

salmaan

Coordinator
Feb 7, 2011 at 6:18 PM

Hi.

Please be more specific in what it is that you want. If it's the source code, you can find it under the Source Code tab. The DLL you can find under the Downloads tab. I have implemented all the functions in API version 1.2.2.

Maria

Feb 8, 2011 at 4:10 AM
Edited Feb 8, 2011 at 11:15 AM

Hi Maria..

thanks for replying......

i have seen this below link

http://wiki.smugmug.net/display/API/API+1.2.2  api is given  for album, family, auth etc....Sample response is given for (Json,Php,Rest,Xml-Rpc) how can i use these api in C#  .net ...i am unable to find that please help me waiting for the reply....

 i am developing an application in C#  win form i want to do the following thing in an application

 

1)--authenticate to smugmug

//==========================================

2)--upload photo to smugmug,....

3)--how to make the photo private at the upload time

//===========================================

 

//=========================================

4)--how to create an album

5)--how to make album private

6)--upload photo to an album of smugmug... using Smummug Api...

//==========================================

 

Any help with the coding perspective .....waiting for the reply...

i want to see some example any documentation or pdf as i want to do some stuff  with c# .net coding for windows application .

 


 

 

Coordinator
Feb 9, 2011 at 2:46 AM

Download the DLLs from the Downloads tab - SmugMugModel_dll.zip. Unzip them and add a reference to them from you project.

Connect to the site by logging in:

Site mySite = new Site();

var user = mySite.Login(“user name”, “password”);


 Create an album (if you don’t want dups, use Unique as well)

1. In the other category:

 var myAlbum = user.CreateAlbum(“myAlbum”);

with Unique: var myAlbum = user.CreateAlbum(“myAlbum”, true);

2. Create a category and then the album in it (if it exists, it won’t be duplicated, you’ll just get a category object from the site):

var myCategory = user.CreateCategory(“myCategory”);

var myAlbum = myCategory.CreateAlbum(“myAlbum”);

3. Create a category and subcategory in it (the same goes here for dupps). And then create the album in that subcategory.

var myCategory = user.CreateCategory(“myCategory”);

var mySubCategory = myCategory.CreateSubCategory(“mySubCategory”);

var myAlbum = mySubCategory.CreateAlbum(“myAlbum”);

 

Get an existing album:

1.Use the hierarchical album tree (categories, subcategories, albums)

var myTree = user.GetTree(true);

List<Album> myAlbums = myTree.Albums;

2.Get all the albums from the site and search for the album you want to upload to

List<Album> myAlbums = user.GetAlbums(true);

foreach (var x in myAlbums)

{

       if (x.Title == “myTitle”)

               return x;

}

 

How to make the album private:

myAlbum.Protected = true;

myAlbum.ChangeSettings();

 

Upload a photo:

var myUpload = myAlbum.CreateUploader();

myUpload.UploadImage(filePath);

 

Last time I checked, SmugMug doesn’t let you specify Private or any other properties for the image when you upload it. I’ll look if you can do it now, I know they added a hidden property on the upload, not sure if it works yet. But you can do it after upload:

myImageList = myAlbum.GetImages(true);

foreach (var myImage in myImageList)

{          

     if (myImage.FileName == filePath)

     {

               myImage.Hidden = true;

               myImage.ChangeSettings();

     }

}

Feb 9, 2011 at 9:38 AM
Edited Feb 9, 2011 at 11:20 AM

Hi Maria,

thanks so much for giving me the reply its really helping me for my application ....

i want to see more stuff other than my requirement...if you have any documentation or pdf ..Can you please send me

Coordinator
Feb 9, 2011 at 11:01 PM

I'm working on creating it in my spare time. It's a large project and I haven't written any thorough documentation for it yet, so it's probably going to take me a while.

Feb 10, 2011 at 3:29 AM

Thanks Maria