Reputation: 129
I have encoded my video in azure media services and I want to request the url into my controller (C#). I check the microsoft site to get the url from https://learn.microsoft.com/en-us/rest/api/media/operations/locator#list_locators
And here is the code:
GET https://<accountname>.restv2.
<location>.media.azure.net/api/Locators('nb:lid:UUID:627cbafb-3d81-4623-
97c2-2194282b6d16') HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.11
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.~~~~
Host: media.windows.net
anyone know how to use this code into my C# controller so I can return the video's url?
Upvotes: 0
Views: 350
Reputation: 2512
Couple issues I noticed:
1) your Authorization: Bearer token looks like the old ACS version - make sure that you are using AAD authentication and JWT tokens. See the docs for AAD authentication support in the REST API.
2) To get a Locator, It may be handy to look at the REST API Postman Collection that I created up here - https://learn.microsoft.com/en-us/azure/media-services/postman-collection
That should show you how to create and Get a locator for Streaming.
There is also an article that covers basic Streaming with the REST API here -https://learn.microsoft.com/en-us/azure/media-services/media-services-rest-deliver-streaming-content
NOTE: That documentation page still has the older style Authorization header. Don't copy that header. You will need to use an Auth Header like this:
Authorization: Bearer {{ENCODED JWT TOKEN}}
Full walkthrough on how to get that JWT Token for AAD is here: https://learn.microsoft.com/en-us/azure/media-services/media-services-rest-connect-with-aad but you can also use my Postman collection as a nice quickstart.
Upvotes: 0