Notebook using queryParameters, how should it work?


#1

Hi!

I am new in the raml world and when using queryParameters, i am not sure what i should expect to happen in the notebook tool.

This is my notebook code:

API.createClient(‘client’, ‘/…some link…/’);

client.licenses.get({type: “illness”})
The response to this is an array WITH ALL THE LICENSES, it does not filter only the “illness” ones as I would expect. I know that filtering for real a json is not something that I should expect… but looking into the Twitter example (https://api-notebook.anypoint.mulesoft.com/examples/twitter), it does it for real… so I am a little bit confused.

This is my code:

/licenses:
get:
description: get licenses
queryParameters:
type:
displayName: type
type: string
description: License type
example: 'illness’
responses:
200:
body:
application/json:
example: |
[
{“type”: “study”,
"creation_date": "2015-10-02"
},
{“type”: “illness”,
"creation_date": "2015-09-29"
}
]

Thanks in advance :smile:


#2

Hey there bordio,
That should be working for you. Dumb question, do you have it hooked up to your mock API or to the fully functional API?

  • Mike

#3

Hi Mike!
Thanks a lot for replying!
I don’t think that is a dumb question, as i am just learning and I might make a lot of mistakes!
I am using the mock API. Is that the reason?


#4

Yepp that would be it. The API Notebook simply returns the data back from the API that you’re calling, and in the case of the MuleSoft mocking service it doesn’t actually provide real-time filtering of the example data.

Once it’s hooked up to a real API that has the filtering built in, it should work for you :smile:

Sorry about the confusion on that!