【正文】
cesclient_id: AccountName,帳戶(hù)名。client_secret:AccountKey,密碼。獲取AccessToken的HTTP 響應(yīng):HTTP/ 200 OKCacheControl: public, nostore, maxage=0ContentType: application/json。 charset=utf8Expires: Fri, 13 Jan 2012 22:40:07 GMTLastModified: Fri, 13 Jan 2012 22:40:07 GMTVary: *Server: MicrosoftIIS/SetCookie: =w3mtu2rnxucaz5tvj0iyfm0t。 path=/。 HttpOnlyXAspNetMvcVersion: XAspNetVersion: XPoweredBy: XContentTypeOptions: nosniffDate: Fri, 13 Jan 2012 22:40:07 GMTContentLength: 580{access_token:%3a%2f%%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=client_idamp。%3a%2f%%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=%3a%2f%%2famp。Audience=urn%3aWindowsAzureMediaServicesamp。ExpiresOn=1326498007amp。Issuer=%3a%2f%2f %2famp。HMACSHA256=hV1WF7sTe%2ffoHqzK%2ftmnwQY22NRPaDytcOOpC9Nv4DA%3d,token_type:,expires_in:3599,scope:urn:WindowsAzureMediaServices}Connecting to the Media Services URI訪問(wèn)媒體服務(wù)的URI:Media Services 的根URI是 。上傳,下載 Asset 的根URI是 ;創(chuàng)建一個(gè)Asset:POST ContentType: application/json。odata=verboseAccept: application/json。odata=verboseDataServiceVersion: MaxDataServiceVersion: xmsversion: Authorization: Bearer %3a%2f%%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=youraccountnameamp。urn%3aSubscriptionId=2f84471db1ae4e75aa09010f0fc0cf5bamp。%3a%2f%%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=%3a%2f%%2famp。Audience=urn%3aWindowsAzureMediaServicesamp。ExpiresOn=1335602357amp。Issuer=%3a%2f%%2famp。HMACSHA256=XQs5T%2fEfdO39%2f0Z9%2fBBkA12%2bbUUEY21YyefWXuRYZlY%3dHost: ContentLength: 27Expect: 100continue{ Name : NewJSONAsset }Ingest Assets with the media Services REST API。用REST 風(fēng)格 API 插入 Assets:插入Asset的步驟:1. Create an Asset 2. Encrypt an Asset3. Upload a file to blob storage the Asset: 創(chuàng)建Asset什么是Asset?an asset is a container for multiple types or sets of objects in Media Services, including video, audio, images, thumbnail collections, text tracks, and closed caption files.POST ContentType: application/json。odata=verboseAccept: application/json。odata=verboseDataServiceVersion: MaxDataServiceVersion: xmsversion: Authorization: Bearer %3a%2f%%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=youraccountnameamp。urn%3aSubscriptionId=2f84471db1ae4e75aa09010f0fc0cf5bamp。%3a%2f%%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=%3a%2f%%2famp。Audience=urn%3aWindowsAzureMediaServicesamp。ExpiresOn=1335602357amp。Issuer=%3a%2f%%2famp。HMACSHA256=XQs5T%2fEfdO39%2f0Z9%2fBBkA12%2bbUUEY21YyefWXuRYZlY%3dHost: ContentLength: 27Expect: 100continue{ Name : NewJSONAsset }Create the assets Response:HTTP/ 201 CreatedCacheControl: nocacheContentLength: 1353ContentType: application/json。odata=verbose。charset=utf8Location: (39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)Server: MicrosoftIIS/xmsrequestid: 7739638ada3a4a6ead51ea0bf87f02adXContentTypeOptions: nosniffDataServiceVersion: 。XAspNetVersion: XPoweredBy: Date: Fri, 27 Apr 2012 22:39:18 GMT{d:{__metadata:{id:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。),uri:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。),type:,actions:{$metadata:[{title:Publish,target:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)/Publish}]}},Locators:{__deferred:{uri:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)/Locators}},ContentKeys:{__deferred:{uri:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)/ContentKeys}},Files:{__deferred:{uri:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)/Files}},ParentAssets:{__deferred:{uri:(39。nb%3Acid%3AUUID%3Aaa5bfdd9900a431daea7fffb0b24f36b39。)/ParentAssets}},Id:nb:cid:UUID:aa5bfdd9900a431daea7fffb0b24f36b,State:0,Created:\/Date(1335566358610)\/,LastModified:\/Date(1335566358610)\/,AlternateId:null,Name:NewJSONAsset,Options:0}}2. Encrypt an Asset(Optional)3. Upload a file to blob storage上傳文件到存儲(chǔ) 傳文件到blob 存儲(chǔ),blob(binary large object)a. Set the AccessPolicy:設(shè)置asset的寫(xiě)權(quán)限,DurationInMinutesb. retrieve a URL to upload the file to c. perform the actual upload actions。step1. Set the AccessPolicyPOST ContentType: application/json。odata=verboseAccept: application/json。odata=verboseDataServiceVersion: MaxDataServiceVersion: xmsversion: Authorization: Bearer %3a%2f%%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=youraccountnameamp。urn%3aSubscriptionId=2f84471db1ae4e75aa09010f0fc0cf5bamp。%3a%2f%%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=%3a%2f%%2famp。Audience=urn%3aWindowsAzureMediaServicesamp。ExpiresOn=1335956356amp。Issuer=%3a%2f%%2famp。HMACSHA256=1B1ysfYRcpI%2fQY9SSNIBBVBpgc67j4R2yXD7BCxs8D8%3dHost: ContentLength: 76Expect: 100continue{Name: NewUploadPolicy, DurationInMinutes : 300, Permissions : 2 }Set the accessPolicy Response:HTTP/ 201 CreatedCacheControl: nocacheContentLength: 526ContentType: application/json。odata=verbose。charset=utf8Location: (39。nb%3Apid%3AUUID%3A94763883537a41c0a0974e3f755bbeab39。)Server: MicrosoftIIS/xmsrequestid: 0a262141e5394fa6b5d680cdf26d3ff6XContentTypeOptions: nosniffDataServiceVersion: 。XAspNetVersion: XPoweredBy: Date: Wed, 02 May 2012 00:59:30 GMT{d:{__metadata:{id:(39。nb%3Apid%3AUUID%3A94763883537a41c0a0974e3f755bbeab39。),uri:(39。nb%3Apid%3AUUID%3A94763883537a41c0a0974e3f755bbeab39。),type:},Id:nb:pid:UUID:94763883537a41c0a0974e3f755bbeab,Created:\/Date(1335920371136)\/,LastModified:\/Date(1335920371136)\/,Name:NewUploadPolicy,DurationInMinutes:300,Permissions:2}}step2. Get The Upload URL 獲得上傳的URL為了獲取真實(shí)上傳URL,必須創(chuàng)建一個(gè)定位器。Create a Locator entity: POST ContentType: application/json。odata=verboseAccept: application/json。odata=verboseDataServiceVersion: MaxDataServiceVersion: xmsversion: Authorization: Bearer %3a%2f%%2fws%2f2005%2f05%