How do I upload to a specific folder using the VIMEO API? - vimeo

I am using a PULL request with the VIMEO PHP Library but I can not find in the docs anywhere how to set the destination folder.
It just sends it to the "Videos" folder by default.
$response = $lib->request('/me/videos', ['upload'=>["approach"=>"pull",'link'=>$url], "name"=>$video['video_title']], 'POST');

You have to upload the video to your account first, then make an additional request that adds the video to the folder:
https://developer.vimeo.com/api/reference/folders#add_video_to_project

Related

Why does the webContentLink access I get through the http interface of the Google cloud disk list report 404

I obtained the file download url through the following interface, and the corresponding field is webContentLink, but why did I return a 404 status code when I accessed this download url. I have tested this problem only with some of these accounts. There is no idea to solve this problem now.
interface address:https://developers.google.com/drive/api/v3/reference/files/list?hl=en&authuser=1
According to their docs, WebContentLink is only available for files with binary content in Google Drive.
If you want to download all kind of file then use the files.get method with the ID of the file to download and set the alt=media URL parameter
Reference: https://developers.google.com/drive/api/guides/manage-downloads#download_a_file_stored_on_google_drive

Google Drive API create and download PDF

Is it possible to call the Google Drive API, create a document based on a template with dynamic data sent from an app that is not a Google Apps Scripts app, and download the document as a PDF.
Based on the Google Drive documentation, The Drive API allows you to download files that are stored in Google Drive. Also, you can download exported versions of Google Documents (Documents, Spreadsheets, Presentations, etc.) in formats that your app can handle. Drive also supports providing users direct access to a file via the URL in the webViewLink property.
Here is an example code that demonstrate on how to download a Google Document in PDF format using the client libraries:
String fileId = "1ZdR3L3qP4Bkq8noWLJHSr_iBau0DNT4Kli4SxNc2YEo";
OutputStream outputStream = new ByteArrayOutputStream();
driveService.files().export(fileId, "application/pdf")
.executeMediaAndDownloadTo(outputStream);
Also check this page for more information.
The documentation has instructions on doing this via an HTTP request. However, it is silent on doing it via the Drive V3 Python API.
I found the solution in this video Google Drive API: Uploading & Downloading Files, released by the official Google Developers YouTube channel.
This example assumes that you have a file created and that you have the authorization setup.
# setup authorization
DRIVE = discovery.build('drive', 'v3', credentials=creds)
file_id = 'your-file-id'
data = DRIVE.files().export(fileId=file_id, mimeType="application/pdf").execute()
if data:
filename = 'your-file-name.pdf'
with open(filename, 'wb') as pdf_file:
pdf_file.write(data)
The file will be downloaded in the current working directory.
I am wondering, if by using that API you can also define which Workbook you want to retrieve and whether the export should be portrait or landscape.
I found out, that you can set key (string)/value (object) settings to the request, but it actually does not work.
Anybody knows how to fine-tune the export via the API. If I am logged in, I can do it via a simple HTTP Get like that (below), but how to do it with the API?
https://docs.google.com/feeds/download/spreadsheets/Export?key=<spreadheetIDHere>&exportFormat=pdf&gid=<workbookIdHere>
best,
fri

Upload in Dailymotion using Google Drive or via email

I have some video in google drive. Can I upload them directly from Google Drive to dailymotion ? or can I upload file via email as attachment ?
Upload via email is not a possible option, but if your videos have a public url, you can upload them to dailymotion directly using the api.
See the documentation at https://developer.dailymotion.com/api#upload-publish-video. Skip steps 2 and 3, and directly post the video using the url field (set to your video source url). basically, you have to make a POST request to https://api.dailymotion.com/me/videos with the required parameters, among which url=<YOUR_VIDEO_URL>

Using vimeo API, can I get the video URL before upload is complete?

When having users upload videos to my vimeo via a form in a WordPress blog, can vimeo return the video URL (to use in the code) before the video upload is actually finished?
No, this is not possible.
The resources required to define an upload url are all created during the completion step of an upload (in POST uploads this is the first redirect to vimeo.com, in PUT uploads this is the DELETE request).
This allows us to verify that you have uploaded a video (and not a text file, or image), and verify that the upload has completed, and is successful, before assigning a URL.

Serve Gmail Attachments with Content Service

I'm using Google Apps Script and Content Service. I would like to provider users with a way to download an attachment for a given Gmail Message.
The Gmail Attachment objects doesn't expose a download URL like the Site Attachment does so I'm trying to use Content Service to serve the bits for the attachment. Content Service appears to only support text and does not have an API for returning byte[].
Is there a work around?
Option 1
You can encode your attachments as Base64 using Utilities.base64Encode() and then decode it at the client end.
Option 2
Save the attachment to Drive, give appropriate permissions and give the link to download the attachment.
As an aside, ContentService is useful only if your attachments are not accessed manually i.e. they are accessed through another program. If your users are manuaaly invoking the script, they might as well be given a link to download the attachment