Requesting OneDrive ...

Post your questions and help other users.

Moderator: Martin

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Requesting OneDrive ...

Post by BoBo » 20 Mar 2020 10:41

... using Action:HttpRequest.

Hi,
I'm using an Amazon Echo to voice trigger sound files that are hosted at Microsoft's OneDrive cloud storage.
To make this happen Alexa's PLP (PLayListPlayer*)-Skill needs the direct download links/path to every one of those MP3-files.
The only way to get those for these files is to extract any respective path from OneDrive's "embedded" link option.
Besides doing this manually on OneDrive, we can request those embedded links using the Onedrive-API:

:arrow: [Creating Embeddable Links]

I was able to use AutoMagics Action:HttpRequest to access OneDrive but the request failed with: "Bad Request"
  • Action Type: HttpRequest
    Name: Standard
    URL: http://onedrive.live.com/root/_Music/Lullabies To Paralize/1234567890/createLink
    Zertifikate: Enabled
    Authentifizerung: Basic
    Request Methode: POST
    ContentType: Genereller Text - application/json
    Daten: <empty>
    Timeout: 1m
    EIgene HTTP Headers: Disabled
    VariableOderFile: Variable
    Variable: response
    Optionen: Disabled
a) of course I used my correct ID (at least what I thought it is)
b) I guess (currently missing) authentification could be an issue??
c) ... or the URL I've created sucks? Please see the reference linked above.

Getting a OneDrive account is free of charge, just in case you wanna test it on my behalf :)
Thx for listening and I appreciate very much any effort to solve this issue.

* [Alexa PLP-Skill] - [PLP Portal (German)]
** PLP works also if pointing to your own NAS/GoogleDrive/DropBox :!:
Last edited by BoBo on 21 Mar 2020 15:07, edited 1 time in total.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Requesting OneDrive ...

Post by Micky Micky » 20 Mar 2020 20:46

Hello,

I haven't got the time to check this for you but it interests me.

The first thing I noticed is the request method being POST. I think that should be GET. I presume you are trying to GET information from Onedrive and not give it information.

Hope this helps

Micky
Crude but it works.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Requesting OneDrive ...

Post by BoBo » 21 Mar 2020 11:41

Thx for your interest. I've used the POST method bc it was the only option for all requests shown at this (also above) linked MS reference
:arrow: https://docs.microsoft.com/en-us/onedri ... createlink

Sample of a OneDrive Sharing Link (not accessible using PLP)
https://1drv.ms/u/s!AgV25rSuK8w-hlNuqW3 ... y?e=vjJAYX

OneDrive Embedded Link (if extracted works with PLP bc it contains the authentification so it qualifies as a valid "download link")
<iframe src="https://onedrive.live.com/embed?cid=3E8 ... iqif_Y-075" width="98" height="120" frameborder="0" scrolling="no"></iframe>

Link after it has been "converted" at xdream2000.com to work with the PLP Skill for Amazon Echoes.
https://onedrive.live.com/download?cid= ... iqif_Y-075


All the above OneDrive/PLP links have been slightly edited bc they are pointing to a valid mp3/m4a, so to prevent licensing issues.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Requesting OneDrive ...

Post by Micky Micky » 21 Mar 2020 18:09

Hi

I see, you're telling it to create the link. There's no link to GET until you say so.

I'll experiment with this, but can't offer any help as what you're doing seems quite advanced.

Good luck

Micky
Crude but it works.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Requesting OneDrive ...

Post by BoBo » 22 Mar 2020 23:58

Well, the idea was ... :idea:
Upload a file to OneDrive and receive its ID in return.
Use that ID to create/request the embedded link.
Extract the link to work with PLP format and add it to a *.txt file (a following automated upload to PLP won't work as it provides no API to do that)

I guess my current issue is the initial proper (token) authentification using HttpRequest ... :roll:
Thx for listening and good luck too :)

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Requesting OneDrive ...

Post by anuraag » 24 Mar 2020 00:15

https://docs.microsoft.com/en-us/onedri ... #code-flow
These are steps to get token

Get a client_id https://apps.dev.microsoft.com/?referre ... edrive.com#

If you can't get it how to do then let me know.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Requesting OneDrive ...

Post by BoBo » 25 Mar 2020 11:52

"If you can't get it how to do then let me know."

So - here I am :P
From my understanding, I would edit the following GET Request sample link accordingly to receive the access token.

GET https://login.microsoftonline.com/commo ... direct_uri}

... means, I've generated an application (client) ID and added it to the link (here it's, of course, a fake ID), changed the scope value to files.read and ... have no clue what to enter as the {redirect_uri} ... :roll:

GET https://login.microsoftonline.com/commo ... direct_uri}

... only to jump into this flood of information afterward, but failed so far :roll:
https://docs.microsoft.com/en-us/azure/ ... s-web-apis
https://docs.microsoft.com/en-us/azure/ ... v2-android :?:

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Requesting OneDrive ...

Post by anuraag » 25 Mar 2020 16:12

Follow https://www.appypie.com/faqs/how-can-i- ... secret-key guide to get client_id and client_secret.

Use this as redirect_uri in above tutorial

Code: Select all

https://login.live.com/oauth20_desktop.srf
Scope

Code: Select all

onedrive.readwrite%20offline_access
Then open following url in browser (replace variables)

Code: Select all

https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope={scope}
  &response_type=code&redirect_uri={redirect_uri}
after confirmation you will be redirected to blank page. url of page will look like this.

Code: Select all

https://login.live.com/oauth20_authorize.srf?code=df6aa589-1080-b241-b410-c4dff65dbf7c
Try above first then I will provide a flow later which will give you refresh_token.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Requesting OneDrive ...

Post by BoBo » 25 Mar 2020 19:19

Done, successfully :)

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Requesting OneDrive ...

Post by anuraag » 26 Mar 2020 05:12

I'm getting error "client isn't enabled for consumers". Don't know what's wrong. There isn't even much information available on web. Use something else like google drive.

Post Reply