400 error from querying custom document UID field

Just trying the REST API and I'm getting a 400 for the following:

https://myidentifier.cdn.prismic.io/api/v2/documents/search?q=[[at(my.post.slug,"test")]]

The error message is:

unexpected field 'my.post.slug' on line:1 col:6 in query '[[at(my.post.slug,"my-post-slug"

The slug field is UID type and the item has been published.

The query at(document.type, 'post') returns all documents correctly.

Any help appreciated!

Hi Paul,

You will just need to change slug to uid and it will work: my.post.uid . You can change the display name of the UID field but not the API ID.

Thanks.

1 Like

thanks for the awesome information.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.