Rails errors code 195 Missing or invalid url parameter when uploading image


#1

Hy all i have a question, i write this script for upload image :smile:

consumer = Twitter.connect
u_token  = @aut_tw.token
u_secret = @aut_tw.secret
access_token = OAuth::AccessToken.from_hash(consumer, token_hash )

feed = Hash.new

unless @post.image.blank?

media = @post.image.url(:original).to_s
response = access_token.post('https://api.twitter.com/1.1/statuses/update_with_media.json',      feed.merge('media[]' => media, 'status' => @post.text))

else

response = access_token.post('https://api.twitter.com/1.1/statuses/update_with_media.json', feed.merge('status' => @post.text))

end

and i receive this error:

Missing or invalid url parameter.

why ??

thanks.


Statuses/update_with_media : Getting "Missing or invalid url parameter"
#2

I’m not sure why this is happening, however you should look at the newer process for uploading media as the update_with_media endpoint is deprecated.


#3

thanks for helpme,
i try the REST API for upload image

https://upload.twitter.com/1.1/media/upload.json

i follow this link guide
https://dev.twitter.com/rest/public/uploading-media-multiple-photos

i get this error message - {“request”:"\/1.1\/media\/upload.json",“error”:“not recognized.”}"


#4

the img i want upload is


#5

I’m getting the same error message : {“request”:"/1.1/media/upload.json",“error”:“not recognized.”}

I have created the body correctly as far as I know, but when the body isn’t there it says media is missing so I assume there isn’t any problems with authentication.

Post Body below image is just a test image so I don’t mind people seeing it :

------------------mediaupload
Content-Disposition: form-data; name=“media”; filename="1.png"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAACFdJREFUeF7t3THo53Udx/HSijodMpeCCIeGcHJoCDsP6646g8rooMjlIAiTBnPxpMFJHAykpZukwUGcbooGh3CyqRZBaNHJpnBwEKdffuz71/P3fZm/ f16POAFgv/vJO n/P93/ /vUweglgBAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACgmAF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Tsu74897bU3tgcYRwCKpWNPWx8iykwCUCwdexpzCUCxdOxpzCUAxdKxpzGXABRLx57GXAJQLB17GnMJQLF07GnMJQDF0rGnMZcAFHv/wO/98NA/bswlAMXSsacxlwAUS8eexlwCUCwdexpzCUCxcxf3x348bwSeTQCKnX9kf/DH pPty9mJAEodspbgdd7A5lLAMpdu74/ rN5G/B8AsDhr38/HO65 uHhf OXh8PTz2//ktEEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACgmABArcPhv/K7PAdX3l1tAAAAAElFTkSuQmCC
------------------mediaupload–