Querying

Any request that returns a collection is queryable.

We implemented a MongoDB query style: any request that’s valid with MongoDB is fine with us. To filter a collection, add to your request the where parameter with a MongoDB query as value.

You can also order the results using the order_by key.

Read about MongoDB query language

Raw HTTP
curl -X https://hull-demos.hullapp.io/api/v1/app/activity?where%5Bactor_id%5D=510fa2394875372516000009&limit=10&skip=0&created_at%5B%24lte%5D=2013-09-24T19%3A03%3A28.894Z
Javascript
Hull.api('/app/activity', {
    where:{
      actor_id:'510fa2394875372516000009',
      created_at:{
        "$lte":"2013-09-24T19:03:28.894Z"
      }
    },
    order_by: 'stats.likes DESC',
    limit:10,
    skip:0
  }, function(response){
    console.log(response)
  }
);

There are a few peculiar mappings to consider when performing requests. Below is a table describing the actual field names you should be using when performing the query.

Object Name Instead of Use this field name
Entity type object_type
User sign_in meta.sign_in
User confirmed confirmed_email

For instance, to filter entities and get only those of type ‘company’:

//Instead of : 
Hull.api('/entities', {where:{type:'company'}})

//Do this:
Hull.api('/entities', {where:{object_type:'company'}})