Get empty response via GraphQL via CURL, but works in visual editor.

I'm trying to get a response from my database via the GraphQL interface. In the visual editor I run:

 {
  booksCollection {
    edges {
      node {
        id
        name
        author
      }
    }
  }
}


And I get the response:
{
  "data": {
    "booksCollection": {
      "edges": [
        {
          "node": {
            "id": "1",
            "name": "Harry Potter and the chamber of secrets",
            "author": "JK Rowling"
          }
        },
        {
          "node": {
            "id": "2",
            "name": "Grapes of wrath",
            "author": "John Steinbeck"
          }
        }
      ]
    }
  }
}


However, trying to do this via CURL (following this part of the documentation: https://supabase.github.io/pg_graphql/supabase/)
curl -X POST https://MYPROJECTID.supabase.co/graphql/v1 \
    -H 'apiKey: MYAPIKEY' \
    -H 'Content-Type: application/json' \
    --data-raw '{"query": "{ booksCollection { edges { node { id, name, author } } } }", "variables": {}}'


I get the empty response

{"data": {"booksCollection": {"edges": []}}}%


What am I doing wrong? I don't get it. I don't have any active RLS policy on my table.
Was this page helpful?