smugmug api json questions
bmsterling
Registered Users Posts: 28 Big grins
Hey all,
I am working on adding SmugMug capablilities to a WordPress plugin that I developed (http://benjaminsterling.com/benjaminsterlinggalleries/) but I am having issues figuring out how to use the api.
The first issue I have is this, I am using the following url to connect to smugmug:
http://api.smugmug.com/hack/json/1.2.0/?APIKey=_APIKEY_&method=smugmug.login.anonymously
When I connect via the browser, I get a forced download file that is of working json:
{"stat":"ok","method":"smugmug.login.anonymously","Login":{"Session":{"id":"_SESSIONID_"}}}
But if I use the same url and try to grab it via php, I get:
{"result":"error","msg":"No Service Provided"}Not sure of the reasoning behind this.
Second issue/request is, does anyone have some example urls that they are using so I can figure out how to better structure my urls?
Lastly, I need to figure out what sizes are the images?
I am working on adding SmugMug capablilities to a WordPress plugin that I developed (http://benjaminsterling.com/benjaminsterlinggalleries/) but I am having issues figuring out how to use the api.
The first issue I have is this, I am using the following url to connect to smugmug:
http://api.smugmug.com/hack/json/1.2.0/?APIKey=_APIKEY_&method=smugmug.login.anonymously
When I connect via the browser, I get a forced download file that is of working json:
{"stat":"ok","method":"smugmug.login.anonymously","Login":{"Session":{"id":"_SESSIONID_"}}}
But if I use the same url and try to grab it via php, I get:
{"result":"error","msg":"No Service Provided"}Not sure of the reasoning behind this.
Second issue/request is, does anyone have some example urls that they are using so I can figure out how to better structure my urls?
Lastly, I need to figure out what sizes are the images?
- Small
- Medium
- Large
- XLarge
- X2Large
- X3Large
- Original
0
Comments
Welcome to dgrin
Can you please make sure that you actually queryed our api here, as our errors are returned in this format...
{"stat":"fail","code":1,"message":""} Not quite sure what you mean here, can you please elaborate.
If you are calling smugmug.images.getURLs or smugmug.images.get with Heavy options set, the image urls will be returned in the response
SmallURL
MediumURL
LargeURL
XLargeURL
.. etc
If one or more isn't in the response, that image size is not available.
One thing I thought I would mention, if you are using PHP have you considered using our php api ? Instead doing whatever JSON response conversion, you simply call unserialize() on the response to turn it into a php array/object.
Let me know if you have any other questions.
Cheers,
David
SmugMug API Developer
My Photos
Thanks for the response.
I wound up finding a old post that had the max size of each image, ie Small == up to 100px x up to 100px.
I was trying to figure out what structure the url had to be in to make calls to the api. I looked at that api docs and there are not a lot of good examples on how to make certain calls. I came across a page the has Feed calls, so that may point me in the right direction, but I needed more info on what each call would do and how I should structure the url to make said calls.
The way my plugin works is that a user will enter in a feed url or enter in a bunch of parameters and the code will build the url, then that url is sent to the server via AJAX and a JSON resonse is sent back. If the server does not handle certain functions (which a surprisingly a large amount don't) the javascript code will execute a JSONP (cross-domain) call, which I believe the SmugMug API does not support just yet. So the url must return a JSON formated string.
I have been successful at bringing in an RSS feed for my gallery and then converting it to an array then to a json string, so I have basic support for SmugMug in my plugin. But I need to give an advanced options set which will allow for keywords, selecting an album list, selecting all photos or just some, and so on.
As it stands now, the purpose is for a user to only grab images from their account, so I just need to figure out how to achieve that.
Thanks.
http://KenzoMedia.com
http://KenzoHosting.com
http://benjaminsterling.com
I also did some more reading in that thread and see some reference to the session id, but the question is, do I need the session id if I am only getting images? This means that I need to make two calls to the server, one to get the session id and another to get the photos, am I correct in this assumption?
http://KenzoMedia.com
http://KenzoHosting.com
http://benjaminsterling.com
yes, that's correct
SmugMug API Developer
My Photos
From what I can tell, the structure doesn't matter as long as it's a legit http request. I've put the method first and last, the session in an argument variable or in a cookie, nothing seems to matter as long as you send everything that's required and do it in a legal http request.
http://wall-art.smugmug.com/
http://KenzoMedia.com
http://KenzoHosting.com
http://benjaminsterling.com