oauth upload
raphinou
Registered Users Posts: 4 Beginner grinner
I've played a bit with oauth and it's working fine (auth, creating albums, listing, etc).
However, for the upload, it is stringly engouraged to use binary methods. Is that possible with oauth, as current documentation shows the usage of a session id.
Thanks
Raphaël
However, for the upload, it is stringly engouraged to use binary methods. Is that possible with oauth, as current documentation shows the usage of a session id.
Thanks
Raphaël
0
Comments
As per my mailing list reply to you.
If you let me know which upload method you are using, I can give you more details.
Cheers,
David
SmugMug API Developer
My Photos
Actually, I can use any method.
I'm using the ruby-oauth gem, and it makes it difficult to change the host to which to send the queries like it is required for smugmug (change the host api.smugmug.com to upload.smugmug.com).
I have the access_token, and now I need to look how I can construct the right request....
Update: I think I can correctly send the request, but get an invalid signature response, error code 35:
r=@access_token.put("http://upload.smugmug.com/upload.jpg", File.read("/home/rb/tmp/upload.jpg"), {"X-Smug-ResponseType" => "JSON", "X-Smug-Version" => "1.2.2", "X-Smug-AlbumID" => "album_id".to_s, "X-Smug-Caption" => "uploadforme.com", "Content-MD5" =>Digest::MD5.hexdigest(File.read("/home/rb/tmp/upload.jpg")) })
r.body
=> "{\"stat\":\"fail\",\"code\":35,\"message\":\"invalid signature\"}"
Strange as I can send other requests successfully:
r=@access_token.get("/services/api/json/1.2.2/?method=smugmug.albums.create&Title=UploadForMe")
"{\"stat\":\"ok\",\"method\":\"smugmug.albums.create\",\"Album\": .....}
Is it really the oauth signature or is it the MD5 of the file that's causing problems?
Raphaël
Hi David,
I'd appreciate your help to help me further. I still get a wrong signature error. What more information can be helpful to get forward?
Thanks
Raphaël