Hi,
I want to do include with filters based on REST REQUEST. Something like :
Albums?filter=[include][favorites]&filter[where][favorites.type]=abc
I am using MYSQL connector
Thanks
In angular sdk
Albums.find({filter:{
inculde://,
where://
}})
Sorry but i want it using REST URL. Iam using CURL and PHP to parse API.
@yagobski error is equal characters after first filter.
Test Albums?filter[include][favorites]&filter[where][favorites.type]=abc
See http://docs.strongloop.com/display/public/LB/Include+filter for more information.
It seems that explorer generates broken url.
Test Albums?filter[include][favorites]&filter[where][favorites.type]=abc
NOT WORKING.
No information in doc pages
@yagobski
You can also use stringified JSON format in a REST query.
For eaxmple:
query string:filter:{"where":{"name":"Post"},"include":["views","wfAss"]}
Each filter needs an equals sign so the first part is:
Albums?filter[include]=favorites
I don't know how to filter an included model.
As @yagobski said, you could try stringified JSON:
Albums?filter={"include":{"relation":"favorites","where":{"type":"abc"}}}
This syntax not work with URL format
{"error":{"name":"Error","status":500,"message":"Relation \"relation\" is not defined for Album model","stack":"Error: Relation \"relation\" is not defined for Album model\n at processIncludeItem
@yagobski share your relations defined in .json file.
Any solution how to write this REST URL to filter inside included model?
Favorite.json
"relations": {
"albums": {
"type": "belongsTo",
"model": "Album",
"foreignKey": "objectId"
}
},
Album.json
"relations": {
"favorites": {
"type": "hasMany",
"model": "Favorite",
"foreignKey": "objectId"
}
},
Closing as a duplicate of #683 and/or #517.
I still not found solution to this problem. #683 and/or #517 just referring to the same question but still no answer.
Most helpful comment
I still not found solution to this problem. #683 and/or #517 just referring to the same question but still no answer.