Make expand parameters in getAsset configurable so users can select what information is requested

Created on 10 October 2023, almost 2 years ago

Problem/Motivation

There's a @todo comment in /src/Client/AcquiaDamClient.php to consider making the expand parameters in the getAsset method configurable. This is a great idea! Can we do that?

try {
      // @todo make this configurable, maybe?
      $expand = 'asset_properties,embeds,file_properties,metadata,metadata_info,metadata_vocabulary,security,thumbnails';

Proposed resolution

Add configuration to /admin/config/acquia-dam to allow users to select parameters. I'm not sure if I have the right wording, but something like:

Select assets to include in response.
Checkboxes with options: asset_properties,embeds,file_properties,metadata,metadata_info,metadata_vocabulary,security,thumbnails.

Remaining tasks

Question: Should the list of options be hardcoded to the current options? Or could/should they be dynamically generated?

User interface changes

Update Acquia Dam admin config page with checkboxes to select which parameters should be included in the getAsset response.

Feature request
Status

Active

Version

1.0

Component

User interface

Created by

🇺🇸United States capysara

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @capysara
  • 🇺🇸United States japerry KVUO

    Bump for jira

  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺

    The case is that there are no or only very few benefits to making it configurable. This GET parameter (docs) controls how much detailed data the API should include in its response regarding the given asset. As the module utilizes its own HTTP Client responsible for sending most of the external requests, and each API endpoint has a dedicated method to call. Nowhere else within the entire codebase of the module does this expand GET parameter have an effect. Therefore, I tend to suggest rather simply deleting these @todo comments and leaving this expand parameter the most optimized for each endpoint as possible.

  • First commit to issue fork.
  • 🇮🇳India rajeshreeputra Pune

    rajeshreeputra changed the visibility of the branch 3392969-asset-type-display to hidden.

  • 🇮🇳India rajeshreeputra Pune

    I've implemented the solution suggested by @baluertl in comment #3 Make expand parameters in getAsset configurable so users can select what information is requested Active . After reviewing the codebase, making the expand parameters configurable would provide minimal benefit since:

    1. The expand parameter is only used in getAsset() methods where the detailed data is actually needed.
    2. Each API endpoint has its own dedicated method with optimized or no parameters.
    3. Making it configurable would add unnecessary complexity without significant value.

    The changes in MR !181 include:

    • Removed the @todo comment from the $expand property documentation, as keeping it hardcoded is the preferred approach.
    • Removed unnecessary expand parameter from the getAssetVersions() method call, as version endpoints don't require the same expanded data as asset detail endpoints.

    This keeps the expand parameters optimized for get asset data endpoint while cleaning up the outdated todo comments. The current implementation is already efficient and doesn't require user configuration.

  • Pipeline finished with Success
    11 days ago
    Total: 2435s
    #555516
Production build 0.71.5 2024