Get OneDrive File ID - api

I've written a snapshot tool that upload my screenshots directly to microsoft onedrive (formerly skydrive) and puts the link into my clipboard.
The tool counts up the resource IDs in order to get the link.
Structure is like this
https://storage.live.com/items/<cid>!<file id>
I wanna know if there is any way via php requests or the onedrive api to get the fileid of the file i just uploaded

When you do a PUT to OneDrive in your snapshot tool there will be a JSON response. In that response will be id, file name and source URL.

You can use the LiveConnectClient.GetAsync (http://msdn.microsoft.com/en-us/library/hh694251.aspx) method to get the file ID.
Here's an example:
LiveConnectClient liveClient = new LiveConnectClient(this.session);
LiveOperationResult operationResult =
await liveClient.GetAsync("file.8c8ce076ca27823f.8C8CE076CA27823F!129");
Replacing "file.8c8ce..." with the file's friendly name will work.

Related

Build a flow using Power Automate to download a CSV file via a link in email and upload the file to Google Drive

I am completely new to Power Automate and have seen similar questions and posts about this topic, but most are addressed by inserting an HTML step at the end, which means it requires a paid version of Power Automate. I'm wondering if it's possible to build a flow with the free version.
If not, I'm also wondering if anyone has ideas on addressing my issue. I receive a CSV report via a URL in the email that sending from Google Ads every day. After I click the "view report" button, it directs me to a webpage and downloads a CSV file automatically. Eventually, I want to download the report and upload it to my Google drive.
I'm attaching the screenshot of the email content if it helps:
Power Automate Flow
HTML to text content
Initialization variable:
Name: startIndex
Type: Integer
indexOf(outputs('Html_to_text')?['body'],'VIEW REPORT')
Initialization variable2:
Name: endIndex
Type: Integer
add(indexOf(outputs('Html_to_text')?['body'],'Learn'),6)
Initialization variable:
Name: url
Type: String
substring(outputs('Html_to_text')?['body'],variables('startIndex'),sub(variables('endIndex'),variables('startIndex')))
Current output in plain text:
VIEW REPORT
[https://urldefense.com/v3/https://notifications.google.com/g/p/AD-FnEz5EAv3CG8aF4CNNPTSIlfZcRG3FiDbia5D0gDCbGwjg0TEhpi3mu5v36iTQxQV0vEUa9-y8NSJNJ8NZFN3HTw9wXaUatKQNt2zVCy6b_8WEfl18LisbGN-N45qaQlRQLNlXIaaeoeN7y2ryAni3ewe9RF1LgBaUwVeV184HMAT3wV6Wazp6m4K9EFNXJMubGCgsiR4bKsSjHYT1n0GUP922CyEqHvuieXoOJcg_zxAajq6NJ8mLrGFpXNzbzuf-Rkxt7K6U41i2sv23k8NjbyJggZzjmYlDCJxMi0Yfrhtp9nv4tHHWHYhmFoDrGlCUBpLIlU1OejCAAPh5b528dfwLEnuJiPZD2jbzSqi2xc0pni5azu6X5ovfYwwt1tOEhE6WMh-skqEAKPZsojJXlsR_1wEo6rjIzkZSPH1PlHZ6hOEf9NSIRsFyOSltCzFMciuSwZ2W9ElpCHJHY7HFtbscgtyCYkwIGF0ul5ZFd1X2TU10n-mNspwbm-nIYnVLU9lkAYwo7hLuIXk0jEYeB_5oBRht8dVRcdxtTe_hdAlP1V6fe5XPiAP7iKMKI1LecsdKdatHhY-Rpfj0ug;!!MOA0!LtG7zavxLCLQxJx_IASs8WS58E9Vyh6h007Aak8KErrQEibrffJ-7nMH43ah2***z9lJsRE$]
Learn
You can't do this with free connectors but this can be achieved via HTTP connector which is a premium connector.
Coming to you situation, i am assuming that you are able to get the actual csv file url (sometimes another url redirect you to actual file url).
Now you simply need to make an HTTP call from Power Automate flow and then create file using OneDrive for Business connector. See my code below, i have used a publicly available csv file to download and i am saving it to a folder in OneDrive directly.

Exporting a list of images from Google Photos or DropBox as CSV

Do any of the major online photo storage/sharing platforms offer a reasonable way to export a set of image URLs and titles as something like a CSV or fetch them as JSON from a REST API?
I am trying to get any sort of clean list of title, url value pairs for all the images in a particular folder or gallery.
Google Drive/Photos would be my prefered platform, but I would switch to DropBox or other service if I could easily get such an export list.
If you're going to use Google Drive, you'll probably end up using these properties from File Resource:
webViewLink - a link for opening the file in a relevant Google editor
or
webContentLink - a link for downloading the content of the file in a
browser.
You can fetch this properties using files.list or files.get.
For Dropbox, you would use the /2/files/list_folder[/continue] endpoints to list the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
Then, you can use /2/sharing/create_shared_link_with_settings to create shared links for the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
Or, to retrieve existing shared links, use /2/sharing/list_shared_links:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
Those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.

How to update Bigcommerce product image to image stored locally?

Why I can't update image this way?
Bigcommerce::createProductImage($product_id, array('image_file'=>'/home/user/bigcommerce/api/picture.jpg'));
The follow code works:
Bigcommerce::createProductImage($product_id, array('image_file'=>'https://cdn6.bigcommerce.com/s-0cvdh/products/32/images/299/apitec71q__46081.1484240387.1280.1280__30161.1484331218.1280.1280.jpg'));
According to the documentation, it is not possible to upload an image locally. The docs say:
When specifying a product image, the image_file should be specified as either:
a path to an image already uploaded via FTP to the import directory (with the path
relative to the import directory); or a URL to an image accessible on the internet.
It doesn't work because the BigCommerce servers have no idea where "/home/user/bigcommerce/api/picture.jpg" lives. That's a file that exists on your local machine, and you're passing a string to BigCommerce telling it where to get the file. It works in the second case because BigCommerce can access that URI.
In more general terms, you need to upload the image to a location that BigCommerce can access it, and then pass a URI that BigCommerce can use to retrieve the image. It may seem a little cumbersome, but it relieves BigCommerce from having to stream large amounts of data through their API.

Can I search/get file by using File ID in Dropbox V2 API?

I'm using Dropbox V2 APIs (C#) to get files/folders from Dropbox account. I am able to fetch particular file/folder by using its specific path. I wanted to know whether there is any way I can fetch file/folder by using ID?
This depends on exactly which operation(s) you're referring to. For example, downloading files and getting metadata for files or folders support specifying file IDs:
https://www.dropbox.com/developers/documentation/http/documentation#files-download
https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata
You would specify the path as a string like "id:a4ayc_80_OEAAAAAAAAAYa".
Searching and listing folders currently do not support this though:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-search
The same applies to the corresponding methods in the SDKs.
Edit: list_folder and search now do support file IDs.

How can i get file's properties for a file in OneDrive?

I am using the REST API for OneDrive. I have a name of a file in the users storage. I want to obtain the properties for this file. According the documentation file's properties can be retrieved
if you have the file ID.(http://msdn.microsoft.com/en-us/library/dn659731.aspx) So I need the file ID and the only way I see to obtain it is to search the whole storage which is really unnecessary.
Is there a way to find properties of a file(with a known name) with a single request to the service?
Ideally the API would support access by path which would do what you require (assuming you have the full path and not just the name). Unfortunately, to my knowledge that isn't supported.
There is a heavy handed approach that may work for you though - you can use the search capabilities of the API to find files with the name you specify:
GET /[userid]/skydrive/search?q=MyVideo.mp4
The documentation is available at the link below:
http://msdn.microsoft.com/en-us/library/dn631847.aspx