AID from UploadPhotoResult

Nov 21, 2007 at 6:16 PM
Hey all,

I want to be able to redirect the users to the pending approval page for images that were just uploaded.

I tried using the following generated link (this is pseudocode):

...but using that strategy I get a 'content currently unavailable' page from FB.

I noticed that the AID stored in UploadPhotoResult is very long, 19 digits, whereas when I navigate from the 'albums pending aproval' link in my notifications, the AID is maybe 5-6 digits long.

1) Is there a reliable page to redirect users to that one can generate?
2) Is the AID stored in UploadPhotoResult correct?

Nov 21, 2007 at 7:59 PM this working.

Found out through a bug report/issue on the FB site that the aid in the API is actually a combination of the aid and the uid, with the uid shifted into the top 32 bits.

A quick shift will get the real aid out, one that you can use in the link I posted above.

So, starting with the aid in the API return value:
1) declare a long (shiftedAid)
2) parse the aid string
3) declare an int (actualAid)
4) set the int the result of the long ANDed with 0x0000FFFF

That's it. Might look something like this:
long shiftedAid= long.Parse(result.AlbumId);
int actualAid = (int)(fbAid & 0x0000FFFF);

If you're on a 32 bit system you can cheat with this:
int actualAid = (int)(long.Parse(result.AlbumId));

actualAid can now be inserted into the the URL in my first post in place of UploadPhotoResult.aid.

Hope this saves someone a headache.


Nov 28, 2007 at 4:14 AM
Nice. Thanks.