Contentful logo

Contentful Community

How to fetch field's allowed values via Delivery API?

#1

Hi,

I have a content model which has a field that has a list of allowed values. I’m attempting to fetch this list via the Delivery API. I managed access the list by referring to the numeric order of content types and fields, but I wasn’t able to figure out how to call upon content type and field by their ID.

client.content_types[1].fields[8].items.raw["validations"][0]["in"]

Help, please? :slight_smile:

0 Likes

#2

Hi @teemu.tammela1,

The structure of the query you’d need for this is described in this section of our documentation, which is a bit different from the one you provided.

After you retrieve your content type as:

content_type = client.content_type 'YourID'

You’d get the validations with:

content_type.items.validations

1 Like

#3

Thanks @gabriel, I’ll give this a try.

0 Likes