My.{custom-type}.{field} in rest api browser not working for me

In the https://your-repository-name.prismic.io/api/v2 (yes, i have put in our repo name), I am querying "everything". I have a custom type of "highlights", which has a field called "title". Putting [at(my.highlights.title, "DNA")] results in an error, [function at(..)] unexpected field 'my.highlights.title' on line: 1 col:6 in query '[[at(my.highlights.title, "DNA")]] with the arrow pointing at the m in my. This is the json:

 {
        "slice_type": "highlights",
        "slice_label": null,
        "items": [],
        "primary": {
          "colour_theme": "Primary (bg: indigo, text: white)",
          "title": [
            {
              "type": "heading3",
              "text": "Once your DNA test kit arrives...",
              "spans": []
            }
          ],
          blah....

Am I using the right structure of the query?

Thanks!

Hi Laura,

It seems the issue here is that you are trying to query a field inside a Slice and querying by a Rich Text field, neither of these options are possible.

I think what you might looking for is the fulltext search:

Let me know if this helps.

Thanks.

ok, thank you Phil. I think i am mixing up custom-type with 'slices'.

1 Like

Yeah it seems so, any of these document queries can only be done by fields in the top level static section of the document. Let me know how you get on and if you have any further questions.

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