Skip to content

How to filter? #2

Open
Open

Description

@jvolker

I would like to filter requests from OF.frames OF.artwork by my username. Using this filter returns an empty result, unfortunately:

let filter = {
  limit: 0,                                
  skip: 0 ,                                
  where: {                                 
    username: 'V'                          
  }
}

This returns an empty result as well:

let filter = {
  limit: 5
}

Not using a filter or using this one works though:

let filter = {
  limit: 0
}

What am I doing wrong here?

Thanks.

Activity

  1. jvolker commented on Sep 23, 2019

    @jvolker
    CollaboratorAuthor

    I've managed to use the filter. What helped me was to use the StrongLoop API Explorer https://api.openframe.io/explorer which showed me the current data model of artworks:

    {
      "title": "string",
      "description": "string",
      "is_public": false,
      "url": "string",
      "thumb_url": "string",
      "author_name": "string",
      "required_extensions": {},
      "format": "string",
      "options": {},
      "id": "string",
      "ownerId": "string",
      "created": "$now",
      "modified": "$now"
    }
    

    Before, I was using username a field which doesn't exist. There is author_name, but it contains what is called Full name in the web app.

    Instead, I'm now using ownerId:

    let filter = {
      limit: 0,                                
      where: {                                 
        ownerId : '5d51eb67a38167076035bca6'                          
      }
    }
    

    … the ownerId is returned by OF.users.login(). It also returns a token which you can then use in the StrongLoop API Explorer to get access to your private data and write permissions.

    I think this is handy information and it should be added/updated in the JSclient docs. The filter and artwork models shown in sections Filtering queries and Fetch a list of Artworks are not up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions