Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to filter? #2

Open
jvolker opened this issue Sep 21, 2019 · 1 comment
Open

How to filter? #2

jvolker opened this issue Sep 21, 2019 · 1 comment

Comments

@jvolker
Copy link
Collaborator

jvolker commented Sep 21, 2019

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.

@jvolker
Copy link
Collaborator Author

jvolker commented Sep 23, 2019

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant