JSON Question

how to pass match option in the request for find method in fortune js adapter

fortune js library enables the API to be json api compliant. we are using it as middleware on top of core WCF services.

the find method of the adapter supports option argument which allows client to pass in various options such as sort, fields and so on. there is a match option in there which allows client to filter data in the response based on a match criteria.

i would like to know how to pass in a value for this in the http get request. i looked in the json api specification but could only find filter query parameter which didn't work for me.

Answer

filter query string parameter is the way to go. so request would look like

http://url?filter[name]='abc'

and in the fortune js adapter you can access it using options as below:

find(id,options){
    console.log(options.match.name);
    //filter your response by name
}