#βœ… Formatting response data

5 messages Β· Page 1 of 1 (latest)

narrow cargo
#

Hi all 😊 I'm making a request to the API with fields: "additional_images.directus_files_id" and the response is:

"additional_images": [
    {
      "directus_files_id": "eeeb4f71-5469-4c6d-b90d-75b998288e85"
    },
    {
      "directus_files_id": "ec0346f5-19b3-47af-b908-f318bfef8ff4"
    }
  ]

Is there a way to remove or rename the key 'directus_files_id' without having to re-process the whole response? I'm building a public-facing API and want to avoid re-mapping all the fields to keep it as clean and quick as possible.

scenic meadowBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

silver oak
#

If you self-host you can create a custom endpoint, but that's kinda 'remapping' or 'reprocessing' imo. The default answer is realistically a no - we return exactly what the field is called and how it's structured in the db

narrow cargo
#

Thought this might be the case, but wondered if there was some secret option somewhere. No big deal, I shall re-map. Thanks!

scenic meadowBOT
#

βœ… Formatting response data