code: def get_tcia_metadata(
      query: str, attribute: str | None = None
  ) -> list:
      """
      Achieve metadata of a public The Cancer Imaging Archive (TCIA) dataset.
  
      This function makes use of The National Biomedical Imaging Archive (NBIA) REST APIs to access the metadata
      of objects in the TCIA database.
      Please refer to the following link for more details:
      https://wiki.cancerimagingarchive.net/display/Public/NBIA+Search+REST+API+Guide
  
      This function relies on `requests` package.
  
      Args:
          query: queries used to achieve the corresponding metadata. A query is consisted with query name and
              query parameters. The format is like: <query name>?<parameter 1>&<parameter 2>.
              For example: "getSeries?Collection=C4KC-KiTS&Modality=SEG"
              Please refer to the section of Image Metadata APIs in the link mentioned
              above for more details.
          attribute: Achieved metadata may contain multiple attributes, if specifying an attribute name, other attributes
              will be ignored.
  
      """
  
      if not has_requests:
          raise ValueError(
              "requests package is necessary, please install it."
          )
      full_url = f"{BASE_URL}{query}"
      resp = requests_get(full_url)
      resp.raise_for_status()
      metadata_list: list = []
      if len(resp.text) == 0:
          return metadata_list
      for d in resp.json():
          if attribute is not None and attribute in d:
              metadata_list.append(d[attribute])
          else:
              metadata_list.append(d)
  
      return metadata_list
  
file_path: MONAI/monai/apps/tcia/utils.py
imports: from __future__ import annotations
  import os
  from typing import Iterable
  import monai
  from monai.config.type_definitions import PathLike
  from monai.utils import optional_import
label_desc: Use image node_id 1 for calling a global function with example usage: get_tcia_metadata(query, attribute) and returns: metadata_list, metadata_list