0

I'm trying to update the ra-data-hasura library to allow filtering based upon partial matches. I've discovered how to call the server over HTTP via the PostMan tool, but cannot find a way to get the "where" property to look for partial (as opposed to exact) matches (see image below). Is there a way to this (e.g. call for something like "WHERE description LIKE 'Milestone%'")?

Image showing PostMan call to Hasura

mrjbj
  • 329
  • 1
  • 10

1 Answers1

1

Either use GraphQL:

http://example.com/v1/graphql

{
  lifeplan_planning_type(
    limit: 10,
    offset: 0,
    where: {description: {_like: "Milestone%"}}
  ) {
    id
    description
  }
}

or a regular SQL:

http://example.com/v1/query
{
    "type": "run_sql",
    "args": {
        "sql": "SELECT * FROM lifeplan.planning_type WHERE description LIKE "Milestone%" LIMIT 10 OFFSET 0 ORDER BY id ASC"
    }
}

More info in Hasura's documentation:

https://hasura.io/docs/1.0/graphql/manual/api-reference/schema-metadata-api/run-sql.html#run-sql

Johan Eliasson
  • 212
  • 1
  • 3