backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs
/// <summary>
/// Get an asset by id.
/// </summary>
/// <param name="app">The name of the app.</param>
/// <param name="id">The id of the asset to retrieve.</param>
/// <returns>
/// 200 => Asset found.
/// 404 => Asset or app not found.
/// </returns>
Get an asset by id.
Get an asset by id .
[HttpGet]
        [Route("apps/{app}/assets/{id}/")]
        [ProducesResponseType(typeof(AssetDto), StatusCodes.Status200OK)]
        [ApiPermissionOrAnonymous(Permissions.AppAssetsRead)]
        [ApiCosts(1)]
        public async Task<IActionResult> GetAsset(string app, DomainId id)
        {
            var asset = await assetQuery.FindAsync(Context, id);
            if (asset == null)
            {
                return NotFound();
            }
            var response = Deferred.Response(() =>
            {
                return AssetDto.FromAsset(asset, Resources);
            });
            return Ok(response);
        }
[ HttpGet ] [ Route ( " " ) ] [ ProducesResponseType ( typeof ( AssetDto ) , StatusCodes . Status200OK ) ] [ ApiPermissionOrAnonymous ( Permissions . AppAssetsRead ) ] [ ApiCosts ( 1 ) ] public async Task < IActionResult > GetAsset ( string app , DomainId id ) { var asset = await assetQuery . FindAsync ( Context , id ) ; if ( asset == null ) { return NotFound ( ) ; } var response = Deferred . Response ( ( ) => { return AssetDto . FromAsset ( asset , Resources ) ; } ) ; return Ok ( response ) ; }
Get an asset by id.
Get an asset by id .
200 => Asset found.
404 => Asset or app not found.
200 = > Asset found . 404 = > Asset or app not found .
app
string
The name of the app.
The name of the app .
id
DomainId
The id of the asset to retrieve.
The id of the asset to retrieve .