Code 5 Issue

euplerideuplerid Posts: 1Registered Users Beginner grinner
Hi wonderful folks!

I'm getting "code 5" responses from SmugMug when I try to upload photos. The full ImageUploadResponse looks like this:
{stat=fail, method=smugmug.images.upload, image=null, code=5, message=system error}

The headers look like this:
{Authorization=oauth_nonce="$NONCE",oauth_signature="$SIGNATURE",oauth_token="$TOKEN",oauth_consumer_key="$KEY",oauth_timestamp="1533759656",oauth_signature_method="HMAC-SHA1",oauth_version="1.0", X-Smug-ResponseType=JSON, X-Smug-AlbumUri=/api/v2/album/MkVZht, Accept=application/json, X-Smug-Version=v2, User-Agent=Portability, Content-Length=75047, X-Smug-Caption=Untitled, Content-Type=image/jpeg, Content-MD5=4qvn...Kw==}

I get the AlbumUri for the X-Smug-AlbumUri header directly from the AlbumResponse when I create an album, not from the album contained in the response. Since there's no "n-" at the beginning, I'm pretty sure it's not a Node URI as I saw in other threads.

This is how I come up with the MD5 signature:
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(contentBytes);
String signature = BaseEncoding.base64().encode(digest);
headersMap.put("Content-MD5", signature);

Anything look wrong to anyone?

Comments

  • mardymardy RussiaPosts: 10Registered Users Big grins
    In my application I'm not even specifying the "Content-MD5" header, and yet it works fine. I recommend you to strip your request to the bare minimum, in order to find where the problem is.

    Also, note that the Authorisation header seems wrong: it must start with a "OAuth" key, like this: "Authorization: OAuth oauth_nonce=...".

    PhotoTeleport: open source, multi platform photo uploader.

Sign In or Register to comment.