X-Resolve-Urls for fields of type Reference

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [x] Documentation issue or request

Current behavior

Currently the Header “X-Resolve-Urls”: “*” can be used to resolve the complete resource Url of a referenced asset, this is working fine.
I am having a schema “Collection” that can reference different other schemas (“Item1Schema”, “Item2Schema”). When retrieving the content of type “Collection” (via Rest-Api) I only get a list of Guids and I do not know which (“Item1Schema”, “Item2Schema”) endpoint I should contact with these Guids in order to retrieve these referenced items.

Expected behavior

Is it possible to get the resolved Urls also for fields of type Reference?
Do you have any idea/best practice?

Minimal reproduction of the problem

  • Create schemas: Collection, Item1Schema, Item2Schema
  • Create a Multi-References field named “Items” at the Collection schema
  • Assign Item1Schema, Item2Schema to the possible Schemas of “Items”

Environment

  • [x] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: [VERSION]

5.4.0

Browser:

  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

Thank you for your good work and this awesome CMS.

There are 2 answers:

  1. Use GraphQL! :wink:

  2. If you don’t want to use graphql, there is also an endpoint, where you can get content by ids, even if you do not know the schema.

It is this one: https://github.com/Squidex/squidex/blob/master/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs#L156

So you can just do GET /api/content/<YOUR-APP>/?ids=1231,4565,6788

In the C# library it also exist, but it part of the contentsclient which is created per schema, but this method is actually not consistent and you can get all content.

Thank you very much, that’s perfect!

1 Like