http POST base64 to GAE datastore produces null values

Hello guys, I am nearing the completion of my app and have gotten stuck at the last step.

I am sending encoded base 64 PNG images to google datastore.

I already have a base64 receiver for the google app engine datastore online and working. And testing the url with body from a website succeed. However when trying the exact same url and body sent from codea, the datastore recognises the images turn into null values.

I cannot find any error messages either and was wondering if anyone has successfully done this before?

function setup()

local url = "https://testsite.appspot.com/_ah/api/images/v1/images"

local var = "{game: \"ykal\",imagei: 99}"  --This is test code for the body

http.request(url, succeed, fail, {["method"]="POST", ["source"] = var})
end

function succeed(data)
    print("callback:"..data)
end

function fail(error)
    print("failed:"..error)
end

I’ve also tried with encoding:

ltn12=require("ltn12")
json = require("dkjson")

function setup()

local url = "https://testsite.appspot.com/_ah/api/images/v1/images"

local var = "{game: \"ykal\",imagei: 99}"  --This is test code for the body

local var2 = json.encode(var)

local var3 = ltn12.source.string(var2)

http.request(url, succeed, fail, {["method"]="POST", ["source"] = var3})
end

function succeed(data)
    print("callback:"..data)
end

function fail(error)
    print("failed:"..error)
end