I'm trying to upload videos to my Vimeo account via their API using the TUS approach.
I've managed to get the first step working fine, using POST https://api.vimeo.com/me/videos to create the video placeholder in Vimeo, and getting a response which includes the video upload.upload_link
The second step requires the binary data of the video to be patched to the upload link returned in step one using PATCH{upload.upload_link} along with some specific headers, which is fine, but what I'm struggling to work out is where and how exactly to include the binary data, as it doesn't really say in the Vimeo API documentation.
Do I just put the binary data in the Body, on it's own? Or do I need to insert it between some code in the body? Or do I set a parameter and add it as a key value, and if so what is the key?
Also, I'm assuming it should be a binary string and not base64, is that correct?
Any help or guidance on this would be much appreciated.
You put the binary data directly in the request body. Vimeo API uploading uses the tus upload protocol. There is more information about the PATCH request at https://tus.io/protocols/resumable-upload.html#patch
Related
I am working on a simple application composed of React Native for my front end and React Express for my API. I am storing images on AWS S3. Uploading images works, and downloading images kind of works.
Postman Get Call on Image using Image Key
As you can see in the link above, when I test the download, it gives me a signed URL which is live for 15 minutes which I can access. The idea is to pass that as my URI to my Image component.
However, when I try to do the same exact thing from my front end using Axios (the API is not deployed, and I am using ngrok to tunnel into it for local easy testing), this is what I get:
Front End Get Call on Image using Image Key
When I attempt to decode the base64 payload string, it is simply restating what the top half of the image says. This issue doesn't occur with many of my other API calls from my front-end through ngrok. I am able to have authorization mechanics, group mechanics, and even OCR functionality via API calls.
Is it because it is returning a hyperlink? Is there a way to return it as simply a string? This is new territory for me. I am using aws-sdk/clients/s3 library and using getSignedUrl, and passing the return of that back via res.status(200).send(signedUrl).
Thank you for reading.
I noticed Instagram and some other image APIs send a link to a photo when a GET request is made for images. Wouldn't the client have to make a GET request for every single link that the API provides? This seems like a lot of extra work for the client. However, most major photo APIs seem to follow this pattern instead of sending actual bytes. Just curious why this is considered a better practice? Thank you!
I have some podcast feeds already up and running in iTunes for my client, but we're thinking of switching their audio from self-hosted to SoundCloud.
Is it possible to use the SoundCloud API to get an mp3 download link and the file length for uploaded tracks?
As an example, here's the enclosure tag from the existing feed for a recent podcast episode:
<enclosure url="http://marfapublicradio.org/wp-content/uploads/2013/08/TLK-130813-Steve-Murdoch-WEB.mp3" length="28077244" type="audio/mpeg" />
If I could just insert SoundCloud track data for the url and length attributes I'd be good to go, but after a brief look through at the API documentation I'm not sure whether it can be done.
Any input would be greatly appreciated.
Seeing this in the related questions list:
SoundCloud, download or stream file via api
led me to further examination of the API docs ( http://developers.soundcloud.com/docs/api/reference#tracks ), where I found that the track properties do include download_url and duration.
So the answer to my question is "yes, it is possible".
Edit as of September 2, 2013:
I was able to make a download link, but only one that initiated a download dialog, and not a URL for an mp3 file that would be appropriate for me feed's enclosure tag.
I tried e-mailing the SoundCloud api support e-mail address, but got no response. I then tried their general support e-mail, and did receive a reply telling me that the answer to my question is NO.
SoundCloud's api does NOT support .mp3 URLs to drop into the enclosure tags in my pre-existing feeds. It was instead suggested that I apply for their podcasting beta, which I will now investigate.
Dealing with this myself at the moment. While I am not immediately seeing a direct link to an mp3, I have noticed that the value for the waveform (a random BBC stream used here) can be used to form a working mp3 url:
First get the track info:
https://api.soundcloud.com/resolve.json?url=https://soundcloud.com/bbc-media-show/nikkei-buys-financial-times&client_id=[yourClientIdHere]
Notice the waveform url:
7Yp3d9EHloKg_m.png
Use that identifier (remove the _m) to form the working stream URL.
http://media.soundcloud.com/stream/7Yp3d9EHloKg.mp3
Forgive my poor text formatting here... I have never used stackoverflow before.
I'm trying to use the Imageshack api to delete an image uploaded to my account.
I have successfully managed to upload an image to it using the API.
https://www.imageshack.us/upload_api.php?url=[URL_OF_THE_IMAGE]&key=[MY_KEY]
I can delete the image uploaded by using the standard interface.
Any solution using the API?
I have managed it by doing the following:
First log in to get an auth_token:
HTTP POST
https://api.imageshack.us/v1/user/login?username=YOUR_USERNAME&password=YOUR_PASSWORD
Parse "auth_token" from the response
Then delete:
HTTP DELETE
https://api.imageshack.us/v1/images/SERVER/FILENAME?auth_token=AUTHTOKEN
In addition to AUTHTOKEN you need include SERVER and FILENAME, I store these from files.server and files.image.filename that come back in the response to the upload API call.
Jamie Clark's solution is what you need, using the proper v1 api. Your sample script is still using the posting methodology from their older API as described here. That one doesn't expose any deletion methods. What Jamie is describing is the API as it is currently, documented here. It's not clear if the API keys are the same, but I'm guessing no - my new one doesn't seem to work with this old call and the link from that google code page for requesting an API key is defunct.
I'm able to upload videos to youtube using their xml input/output format but their documentation on how to implement uploading with json-c is frustratingly sparse. For instance, what is the 'key' for the json data I'm sticking in the body? Or put a different way, how is the json string added to the body of the request?
Here are instructions for uploading a video using JSON-C:
https://developers.google.com/youtube/2.0/developers_guide_jsonc#Add_Video
The upload is done in two parts: 1) First you upload the metadata in JSON format. The response of this will contain an upload url. 2) Upload the actual video to the upload url.
However #Alexander is right, the Objective-C client may be a better route, since it handles all the upload details for you:
http://code.google.com/p/gdata-objectivec-client/