Open MeijerN opened 4 years ago
Hi yes possible for it you need add some code on model like that
if ($this->input->get('active')) {
$this->db->where('active', $this->input->get('active'));
}
/application/models/Model_blog.php
you can add in count_all and get function
I added the code in count_all
and get
function with the minor change of active
to actief
because thats the fields actual name in my database (Dutch language, maybe better to stick to English in the future). Iam however still confused how to pass 2 parameters in one api request.
How do i use 2 parameters in Cicool like above? Only one parameter works fine (api key and token have been changed to xxx)
And do you know how to pass 2 parameters in my python code?
One parameter like below works, but i also want to filter out the active users from sessie
.
parameter = {'filter': '6', 'field': 'fk_user'}
<-- filter: 0 and field: actief must somehow be included
header = {'X-Api-Key': 'xxx', 'X-Token': 'xxx'}
response = requests.get("http://www.niek-meijer.nl:80/kantineapp/api/sessie/all", headers=header, params=parameter)
I tried this to include the second parameter but it simply returns all the data in the sessie
table again:
parameter = {'filter': '6', 'field': 'fk_user' ,'filter': '0', 'field': 'actief' }
and
parameter = {'filter': ['6', '0'], 'field': ['fk_user', 'actief'] }
Thank you for your swift responses!
Hi!
I really enjoy your application! At the moment iam trying to write a API request using Python3. Iam using parameters to filter the right information. At the moment iam not able to put multiple parameters in.
Iam using this api request:
parameter = {'filter': '6', 'field': 'fk_user'}
header = {'X-Api-Key': 'xxx', 'X-Token': 'xxx'}
response = requests.get("http://www.niek-meijer.nl:80/kantineapp/api/sessie/all", headers=header, params=parameter)
With this request iam getting the data from the right
User
. To filter out the user who are active at the moment i want to add a second parameter to only show user with the fieldactief
set to '0'. I have tried everything but iam not able to fix this. Is this possible?Thanks in advance!