开发者

Why do I get a connection timeout for facebook api-video?

This is the API c开发者_StackOverflow社区all Im attempting:

http://developers.facebook.com/docs/reference/rest/video.upload

(Video upload is not available in the new Graph API.)

I have tried many variations on the parameters. The code below is my best guess. If I modify the params to be obviously incorrect, change to http (not https) or try to use api.facebook.com for video, I get proper errors back.

However, my code below just waits a few minutes before reporting:

ETIMEDOUT: Connection timed out

Also included is working code to upload a photo - which is almost identical.

Ruby:

# Facebook Old-API method - testing only - this works.
def post_photo
  url = "https://api.facebook.com/method/photos.upload"
  body = {
    nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :aid => "Test Photos",
    :caption => "Test",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

# Facebook Old-API method - doesn't work - connection timeout.
def post_video
  url = "https://api-video.facebook.com/method/video.upload"
  body = {
    :nil => File.new(self.media.media_files.first.source_file, 'rb'),
    :access_token => self.session.auth_data[:access_token],
    :callback => "none",
    :title => "Test title",
    :description => "Test description",
    :privacy => "{ value: 'EVERYONE' }",
    :uid => self.session.auth_data[:uid],
  }
  response = RestClient.post url, body
end

PS: Im in Australia - is the API limited to eg the USA?

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜