Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to POST an image to Twitter by gideros UrlLoader api — Gideros Forum

How to POST an image to Twitter by gideros UrlLoader api

louislouis Member
edited April 2012 in General questions
twitter api have a post a tweet with media,
the api document url is : https://dev.twitter.com/docs/api/1/post/statuses/update_with_media
""
Your POST request's Content-Type should be set to multipart/form-data with the media[] parameter
""

but gideros api
is

UrlLoad.new("https://dev.twitter.com/docs/api/1/post/statuses/update_with_media",UrlLoader.POST,bodydata)

Likes: jdlehman

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • atilimatilim Maintainer
    Hi @louis,

    Currently, it's not possible to specify headers (e.g. Content-Type) with UrlLoader. I'm adding it http://bugs.giderosmobile.com/issues/95 It'll be available with the next version.
  • @Atilim, that will be cool, if you have a table for data instead of the string, then you can allocate for headers, and body and any other stuff that one would want to add to it.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • atilimatilim Maintainer
    edited April 2012
    @OZApps Yes, the header information is given as a table and body is still string. But I haven't combine these two into a table (to be backward compatible).
    local url = "<a href="http://www.example.com/parse.php" rel="nofollow">http://www.example.com/parse.php</a> "
    local header = {}
    header["Content-Type"] = "application/x-www-form-urlencoded"
    local body = "key1=value1&key2=value2"
    UrlLoader.new(url, UrlLoader.POST, header, body)
    And if you don't want to specify any headers, you can omit it:
    UrlLoader.new(url, UrlLoader.POST, body)
    I think it's still simple. I hope I don't need to add an extra parameter in the future.

  • this will be in the new release (due sometime soon) right? That will be wonderful..
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
Sign In or Register to comment.