I'm trying to use Windows Azure Media Service to upload a video using their REST API.
What i have done so far is that i have obtained an access_token successfully. Following the guide on their website, i now need to create an Asset. The tutorial for this part tells me that i need to fire such request:
POST https://media.windows.net/API/Assets HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.1
Authorization: Bearer my-access-token
Host: media.windows.net
Content-Length: 27
Expect: 100-continue
{ "Name" : "NewJSONAsset" }
But my response is way different than the one provided in the guide. It looks like that:
{
"odata.metadata": "https://wamshknclus001rest-hs.cloudapp.net/api/$metadata",
"value": [
{
"name": "AccessPolicies",
"url": "AccessPolicies"
},
{
"name": "Locators",
"url": "Locators"
},
{
"name": "ContentKeys",
"url": "ContentKeys"
},
{
"name": "Files",
"url": "Files"
},
{
"name": "Assets",
"url": "Assets"
},
{
"name": "IngestManifestFiles",
"url": "IngestManifestFiles"
},
{
"name": "IngestManifestAssets",
"url": "IngestManifestAssets"
},
{
"name": "IngestManifests",
"url": "IngestManifests"
},
{
"name": "StorageAccounts",
"url": "StorageAccounts"
},
{
"name": "Tasks",
"url": "Tasks"
},
{
"name": "NotificationEndPoints",
"url": "NotificationEndPoints"
},
{
"name": "Jobs",
"url": "Jobs"
},
{
"name": "TaskTemplates",
"url": "TaskTemplates"
},
{
"name": "JobTemplates",
"url": "JobTemplates"
},
{
"name": "MediaProcessors",
"url": "MediaProcessors"
},
{
"name": "Operations",
"url": "Operations"
},
{
"name": "Origins",
"url": "Origins"
}
]
}
What's more - i'm getting the exact same response for all other api endpoints (GET /assets
, GET /jobs
etc).
I'm sure it's quite simple issue to solve and i'm missing something here.
I had used Media Services long time back (so I may be wrong) but I think there's an issue with your endpoint. Even though the default endpoint for connecting to media service is
https://media.windows.net/
, however, when implementing REST wrapper, we would need to first connect to this URI to find out if Media Service is redirecting us to a new URI or not.Please ensure that this issue is not causing the problem you're facing. I also wrote some blog posts (though now quite old) about consuming Media Services REST API which you may find useful: http://gauravmantri.com/2012/10/10/windows-azure-media-service-part-iii-managing-assets-via-rest-api/.