0

I am developing a new interface for an existing Drupal website and we will continue to use Drupal in headless mode using the REST API while we migrate to a better long term solution.

Exposing custom content types seems pretty straightforward for the most part, but one aspect is giving me a headache: It seems impossible to expose the list of allowed values in a list field (e.g. categories that were defined in drupal). Ideally, i believe there should be a way to query the API for a given list field returning a list of possible values for that field.

The closest I've gotten is through the Entity Rest Extra module, but while it exposes a ton of information on the fields, even default value for the list field, the allowed values are not there.

Is there a way to expose the allowed values list in the restful API?

Since the module I found is so close to what I need, would it be easily implemented by custom patching my PHP code? Where should I look for clues?

  • Hey hey, welcome to DA. Seems you haven't figured out yet how to write a custom module, with a controller, that returns a response, right? So, that makes the question a little bit too broad to handle. If I'm just wrong, please provide some sample code so we know how far you got and where you got stuck. Else, just follow the rough outline I sketched by following the docs or any other tutorial you can find out there :) – leymannx May 28 '18 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.