AccessPolicy
An AccessPolicy defines the permissions and duration of access to an Asset.
This topic gives an overview of the AccessPolicy
entity and also demonstrates how to execute various operations with the Media Services REST API.
Important
When accessing entities in Media Services, you must set specific header fields and values in your HTTP requests.
For more information, see Setup for Media Services REST API Development and Connecting to Media Services with the Media Services REST API.
AccessPolicy Entity Properties
Property | Type | Description |
---|---|---|
Id Read-only. Set by Media Services at creation time. |
Edm.String | Unique identifier. |
Created Read-only. Set by Media Services at creation time. |
Edm.DateTime | Represents the number of milliseconds since midnight Jan 1, 1970. |
LastModified Read-only. Set by Media Services. |
Edm.DateTime | This value is updated by Media Services after any property changes are made. It represents the number of milliseconds since midnight Jan 1, 1970. |
Name Required. |
Edm.String | Friendly name for your AccessPolicy. |
DurationInMinutes Required. |
Edm.Double | Duration that the AccessPolicy is valid for. |
Permissions Optional. |
Edm.Int32 | This value specifies the access rights the client has when interacting with the Asset. Valid values are: - None = 0 - Read = 1 - Write = 2 - Delete = 4 - List = 8 The default value is 0. Note that the List permission should not be used when creating OnDemandOrigin locators. |
Create an AccessPolicy
AccessPolicies can be created with a POST HTTP request.
Method | Request URI | HTTP Version |
---|---|---|
POST | https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies | HTTP/1.1 |
Sample Request
To get the latest x-ms-version:
, see Media Services REST.
POST https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.19
Authorization: Bearer <token value>
Host: media.windows.net
Content-Length: 67
Expect: 100-continue
{"Name": "NewUploadPolicy", "DurationInMinutes" : "100", "Permissions" : 2 }
List AccessPolicies
AccessPolicies can be retrieved using a GET HTTP request.
Method | Request URI | HTTP Version |
---|---|---|
GET | https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies | HTTP/1.1 |
Method | Request URI | HTTP Version |
---|---|---|
GET | https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies('accesspolicyid') | HTTP/1.1 |
Method | Request URI | HTTP Version |
---|---|---|
GET | https://<accountname>.restv2.<location>.media.azure.net/api/Assets('assetid')/AccessPolicies | HTTP/1.1 |
Sample Request
To get the latest x-ms-version:
, see Media Services REST.
GET https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies('nb:pid:UUID:ad05d8fa-06a2-4e2f-8fb4-fac57875135a') HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.19
Authorization: Bearer <token value>
Delete an AccessPolicy
AccessPolicies can be deleted using a DELETE HTTP request.
Method | Request URI | HTTP Version |
---|---|---|
DELETE | https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies('accesspolicyid') | HTTP/1.1 |
Sample Request
To get the latest x-ms-version:
, see Media Services REST.
DELETE https://<accountname>.restv2.<location>.media.azure.net/api/AccessPolicies('nb:pid:UUID:ad05d8fa-06a2-4e2f-8fb4-fac57875135a') HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.19
Authorization: Bearer <token value>
Host: media.windows.net
Content-Length: 0
See Also
ContentKey
Asset
AssetFile
Job
JobTemplate
Locator
MediaProcessor
Task
TaskTemplate
Quotas and Limitations