In this article:
Get an Asset
Retrieve details of an Asset in the Media Services account.
GET https://{{apiEndpoint}}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}?api-version={{api-version}}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
accountName |
path | True | string | The Media Services account name. |
assetName |
path | True | string | The Asset name. |
resourceGroupName |
path | True | string | The name of the resource group within the Azure subscription. |
subscriptionId |
path | True | string | The unique identifier for a Microsoft Azure subscription. |
api-version |
query | True | string | The version of the API to be used with the client request. |
Responses
Name | Type | Description |
---|---|---|
200 OK | Asset | OK |
Other Status Codes | ErrorResponse | Detailed error information. |
Examples
Get an Asset by name
Technology | Sample request |
---|---|
HTTP |
GET https://{{apiEndpoint}}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/assets/ClimbingMountAdams?api-version=2022-08-01 |
Java |
/** Samples for Assets Get. */ public final class Main { /* * x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json */ /** * Sample code: Get an Asset by name. * * @param manager Entry point to MediaServicesManager. */ public static void getAnAssetByName(com.azure.resourcemanager.mediaservices.MediaServicesManager manager) { manager .assets() .getWithResponse("contosorg", "contosomedia", "ClimbingMountAdams", com.azure.core.util.Context.NONE); } } To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Python |
from azure.identity import DefaultAzureCredential from azure.mgmt.media import AzureMediaServices """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-media # USAGE python assetsgetbyname.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ def main(): client = AzureMediaServices( credential=DefaultAzureCredential(), subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.assets.get( resource_group_name="contoso", account_name="contosomedia", asset_name="ClimbingMountAdams", ) print(response) # x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json if __name__ == "__main__": main() To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Go |
package armmediaservices_test import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json func ExampleAssetsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armmediaservices.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAssetsClient().Get(ctx, "contoso", "contosomedia", "ClimbingMountAdams", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.Asset = armmediaservices.Asset{ // Name: to.Ptr("ClimbingMountAdams"), // Type: to.Ptr("Microsoft.Media/mediaservices/assets"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountAdams"), // Properties: &armmediaservices.AssetProperties{ // Description: to.Ptr("A documentary showing the ascent of Mount Adams"), // AlternateID: to.Ptr("CLIMB00002"), // AssetID: to.Ptr("1b648c1a-2268-461d-a1da-742bde23db40"), // Container: to.Ptr("asset-1b648c1a-2268-461d-a1da-742bde23db40"), // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2013-02-01T00:00:00.000Z"); return t}()), // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-01T00:00:00.000Z"); return t}()), // StorageEncryptionFormat: to.Ptr(armmediaservices.AssetStorageEncryptionFormatNone), // }, // } } To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
JavaScript |
const { AzureMediaServices } = require("@azure/arm-mediaservices"); const { DefaultAzureCredential } = require("@azure/identity"); /** * This sample demonstrates how to Get the details of an Asset in the Media Services account * * @summary Get the details of an Asset in the Media Services account * x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json */ async function getAnAssetByName() { const subscriptionId = process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso"; const accountName = "contosomedia"; const assetName = "ClimbingMountAdams"; const credential = new DefaultAzureCredential(); const client = new AzureMediaServices(credential, subscriptionId); const result = await client.assets.get(resourceGroupName, accountName, assetName); console.log(result); } To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
.NET |
using System; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Media; // Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json // this example is just showing the usage of "Assets_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); // this example assumes you already have this MediaServicesAccountResource created on azure // for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "contoso"; string accountName = "contosomedia"; ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId); // get the collection of this MediaAssetResource MediaAssetCollection collection = mediaServicesAccount.GetMediaAssets(); // invoke the operation string assetName = "ClimbingMountAdams"; bool result = await collection.ExistsAsync(assetName); Console.WriteLine($"Succeeded: {result}"); To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue. |
Sample response
GET https://{{apiEndpoint}}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/assets/ClimbingMountAdams?api-version=2022-08-01
Sample response
Status code: 200
{ "name": "ClimbingMountAdams", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountAdams", "type": "Microsoft.Media/mediaservices/assets", "properties": { "assetId": "1b648c1a-2268-461d-a1da-742bde23db40", "created": "2013-02-01T00:00:00Z", "lastModified": "2017-11-01T00:00:00Z", "alternateId": "CLIMB00002", "description": "A documentary showing the ascent of Mount Adams", "container": "asset-1b648c1a-2268-461d-a1da-742bde23db40", "storageEncryptionFormat": "None" } }
Definitions
Name | Description |
---|---|
Asset | An Asset. |
AssetStorageEncryptionFormat | The Asset encryption format. One of None or MediaStorageEncryption. |
createdByType | The type of identity that created the resource. |
ErrorAdditionalInfo | The resource management error additional info. |
ErrorDetail | The error detail. |
ErrorResponse | Error response. |
systemData | Metadata pertaining to creation and last modification of the resource. |
Assets
Name | Type | Description |
---|---|---|
id | string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/ |
name | string | The name of the resource. |
properties.alternateId | string | The alternate ID of the Asset. |
properties.assetId | string | The Asset ID. |
properties.container | string | The name of the asset blob container. |
properties.created | string | The creation date of the Asset. |
properties.description | string | The Asset description. |
properties.lastModified | string | The last modified date of the Asset. |
properties.storageAccountName | string | The name of the storage account. |
properties.storageEncryptionFormat | The Asset encryption format. One of None or MediaStorageEncryption. | |
systemData | systemData | The system metadata relating to this resource. |
type | string | The type of the resource, e.g., "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
AssetStorageEncryptionFormat
The Asset encryption format. One of None or MediaStorageEncryption.
Name | Type | Description |
---|---|---|
MediaStorageClientEncryption | string | The Asset is encrypted with Media Services client-side encryption. |
None | string | The Asset does not use client-side storage encryption (this is the only allowed value for new Assets). |
createdByType
The type of identity that created the resource.
Name | Type |
---|---|
Application | string |
Key | string |
ManagedIdentity | string |
User | string |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info | object | The additional info. |
type | string | The additional info type. |
ErrorDetail
Name | Type | Description |
---|---|---|
additionalInfo | ErrorAdditionalInfo | The error additional info. |
code | string | The error code. |
details | ErrorDetail | The error details. |
message | string | The error message. |
target | string | The error target. |
ErrorResponse
Name | Type | Description |
---|---|---|
error | ErrorDetail | The error object. |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt | string | The timestamp of resource creation (UTC). |
createdBy | string | The identity that created the resource. |
createdByType | createdByType | The type of identity that created the resource. |
lastModifiedAt | string | The timestamp of resource last modification (UTC). |
lastModifiedBy | string | The identity that last modified the resource. |
lastModifiedByType | createdByType | The type of identity that last modified the resource. |