Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get a single asset by assetId
    Use the Digizuite service IAssetSearchService

    Code Block
    var assetSearchService = serviceProvider.GetRequiredService<IAssetSearchService>();
    var assetResponse = await assetSearchService.GetAsset(75);

    The response model can be found at DC 5.8 [core api] Get assets

  2. Get a list of assets
    Use the Digizuite service IAssetSearchService

    Code Block
    var assetSearchService = serviceProvider.GetRequiredService<IAssetSearchService>();
    var getAssetsRequest = new GetAssetsRequest
    {
        AssetIds = new HashSet<int> { 75, 76 }
    };
    var assetResponse = await assetSearchService.GetAssets(getAssetsRequest);

    The response model can be found at DC 5.8 [core api] Get assets

  3. Freetext search for assets and sort by assetId desending
    Use the Digizuite service IAssetSearchService
    Here we search for assets with the following search criteria:
    Freetext.
    Count, the number of assets pr page.
    Skip, set to 0, which is page 1.
    SortBy, here we sort by the highest assetId.

    Code Block
    var assetSearchService = app.Services.GetRequiredService<IAssetSearchService>();
    var assetSearchRequestFreetext = new AssetSearchRequest()
    {
        FreeText = "Test",
        Count = 12,
        Skip = 0,
        SortBy = new List<SortField>
        {
            new SortField
            {
                Order = SortOrder.Descending,
                SearchKey = "assetId"
            }
        }
    };
    var assetResponse = await assetSearchService.SearchForAssets(assetSearchRequestFreetext);