Error message when creating new video via API

Jeremy 's Avatar

Jeremy

07 Mar, 2012 03:12 AM

I think I have solved the issue, https://www.universalsubtitles.org/api2/partners/videos/

ends with a /, which is actually not going to work with the param string that was getting appended to it.

  1. 1 Posted by Jeremy on 07 Mar, 2012 03:12 AM

    Jeremy 's Avatar

    I think I have solved the issue, https://www.universalsubtitles.org/api2/partners/videos/

    ends with a /, which is actually not going to work with the param string that was getting appended to it.

  2. 2 Posted by Jeremy on 07 Mar, 2012 03:27 AM

    Jeremy 's Avatar

    No, actually not. So submitting without the trailing slash gave me a 200 response, but the video is not uploaded.

  3. 3 Posted by Jeremy on 07 Mar, 2012 09:01 PM

    Jeremy's Avatar

    I'm not sure what happened to my original post, which I then responded to, so I'm reposting roughly the original question:

    Originally I was making requests to:

    https://www.universalsubtitles.org/api2/partners/videos/

    Using headers: X-api-username, X-apikey, Accept, with my username, apikey, and application/json respectively.

    I get response back:
    {"error_message": "Sorry, this request could not be processed. Please try again later."}

    The video I am trying to upload is a vimeo link:

    http://vimeo.com/37684374

    and uses video_url parameter

    If I make the post request to: https://www.universalsubtitles.org/api2/partners/videos
    I get back a response 200... and then some json showing many many videos, and the video does not appear on my account. Note the only difference here is the trailing forward slash. These are both being made as POSTS.

  4. Support Staff 4 Posted by m.shamraeva on 07 Mar, 2012 10:33 PM

    m.shamraeva's Avatar

    Jeremy,

    Does it still fail for you if you make the following request:

    POST https://www.universalsubtitles.org/api2/partners/videos/?format=json

    with all the other parameters same as before?

    Best regards,

    Margarita Shamraeva
    Universal Subtitles

  5. 5 Posted by Jeremy on 07 Mar, 2012 11:02 PM

    Jeremy's Avatar

    Yup, adding the format=json parameter doesn't change the response at all.

    This is with username OneClickToCaptionAPI, by the way.

  6. Support Staff 6 Posted by arthurdebert on 07 Mar, 2012 11:20 PM

    arthurdebert's Avatar

    Hi Jeremy.

    I see API calls failing on production with an empty request body.
    Subs should be sent on the request payload, i.e. the body of the POST request, and not as a url parameter.

    Can you paste your exact call as made by curl? It will help be debug this.

    Thank you
    Arthur

  7. 7 Posted by Jeremy on 07 Mar, 2012 11:33 PM

    Jeremy's Avatar

    Ah, so the API says:

    video_url : The url for the video. Any url that Universal Subtitles accepts will work here. You can send the URL for a file (e.g. http:///www.example.com/my-video.ogv) , or a link to one of our accepted providers (youtube, vimeo, dailymotion, blip.tv)

    As one of the post parameters. You also want the body of the post to contain the actual file itself? What if I just have a vimeo link, or direct external link? (http://example.videos/things.mp4)

    I am currently doing tests via the Poster plugin for Firefox, not curl. The eventual case will be doing direct file linking, where the file itself isn't local to the box sending the request.

  8. 8 Posted by Jeremy on 07 Mar, 2012 11:35 PM

    Jeremy's Avatar

    Just noticed that Arthur above was talking about Subs, which I am not testing yet. That will come as step two once the video is uploaded. AT the moment I am simply attempting to send video. Should I also grab the SRT and post that at the same time? Is that implied and I just misunderstood the documentation?

  9. 9 Posted by Jeremy on 07 Mar, 2012 11:41 PM

    Jeremy's Avatar

    For the sake of completeness I ran one test, with the same result, using the video_url param as part of the post body.

  10. Support Staff 10 Posted by m.shamraeva on 07 Mar, 2012 11:44 PM

    m.shamraeva's Avatar
  11. Support Staff 11 Posted by m.shamraeva on 07 Mar, 2012 11:46 PM

    m.shamraeva's Avatar

    Sorry, got it poorly formatted in the previous message - trying again:

    URL - https://www.universalsubtitles.org/api2/partners/videos/?format=json
    Content Type: application/json
    Content to send:
    {"video_url":"http://vimeo.com/37684374"}
    On Parameters tab:
    Name: X-api-username Value: [my username]
    Name: X-apikey Value: [my API key]
    
  12. 12 Posted by Jeremy on 07 Mar, 2012 11:59 PM

    Jeremy's Avatar

    Parameters tab, you mean headers tab?

    I use the same information and now get {"video_url": ["Video URL already exists"]}

    So I try a different vimeo video, and still get video already exists.

    The difference between this and previous attempts is that before I was using the Accept: Application/json header, and this time I was just setting the content type to application/json.

    https://www.universalsubtitles.org/api2/partners/videos/?format=json
    Content Type: application/json
    Content to send:    {"video_url":"http://vimeo.com/27644466"}
    On Headers tab:
    Name: X-api-username Value: [Cogi's username]
    Name: X-apikey Value: [Cogi key]
    
  13. Support Staff 13 Posted by m.shamraeva on 08 Mar, 2012 12:10 AM

    m.shamraeva's Avatar

    I submit X-Api-username and X-apikey via the 3rd tab, Parameters.

    Anyway, the response is correct - this video already exists at http://www.universalsubtitles.org/en/videos/5Ak9inD2aN7O/info/Untit.... It was posted today, 21 hours ago, by Ryan S.

    I think the next time POST should work with a new video that is not a duplicate of a previously uploaded one.

    Best regards,

    Margarita Shamraeva
    Universal Subtitles

  14. 14 Posted by Jeremy on 08 Mar, 2012 12:23 AM

    Jeremy's Avatar

    Excellent. Apparently all the random test files I tried were pre-existing (Darn it Ryan!) so I grabbed random cat video off Youtube and successfully created the video.

    The rammifications that a single video_url is unique accross all accounts is a bit worrying, but not important for the moment.

    Formatted, here is what was returned:

    {
      "all_urls": [
        "http://www.youtube.com/watch?v=4DKBBcSr2iI"
      ],
      "created": "2012-03-07T18:14:26.064202",
      "description": "Boring old footage...as I wait cameraless before I can film my next     project.\n\nFlippy is dreaming about the twitter bird towards the end (or maybe Elvis)...if you're interested in pointless updates on twitter, follow me http://www.twitter.com/flippycat",
      "duration": 44,
      "id": "ClV61mj8ERT4",
      "languages": [
    
      ],
      "original_language": null,
      "resource_uri": "/api2/partners/videos/ClV61mj8ERT4/",
      "site_url": "https://www.universalsubtitles.org/videos/ClV61mj8ERT4/info/",
      "thumbnail": "http://i.ytimg.com/vi/4DKBBcSr2iI/3.jpg",
      "title": "Boring Cat",
      "video_url": "http://www.youtube.com/watch?v=4DKBBcSr2iI"
    }
    

    Is ithat key labelled 'resource_uri' a typo? I feel it should be 'resource_url' .

    Anyhow, thanks for the help.

  15. Support Staff 15 Posted by m.shamraeva on 08 Mar, 2012 12:40 AM

    m.shamraeva's Avatar

    Yes, this is the correct HTTP response. Congratulations on successful submission!

    "uri" stands for uniform resource identifier, so it should not be a typo.

    You are very welcome; if you have further questions, please feel free to ask!

    Best regards,

    Margarita Shamraeva
    Universal Subtitles

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac