Presently I am running MatterMost version 4.1.0 on Ubuntu 16.04. There is a script which automatically runs for disabling the users who leaves my organization. The script is working fine for the apiv3 but not for apiv4. When I try to fetch all the users through the curl command it just fetches only 60 users (by default) whereas in apiv3 I was able to fetch all the users by mentioning the same in the url https://mattermost.example.com/api/v3/users/0/100. How can I achieve the same with the apiv4.
I need another help for deactivating a user, I am trying the below curl command but somehow it is not doing the job and saying “active” parameter is missing in the request body whereas I have supplied the “active” parameter.
where wrjff9bcdid1jd8whm7xs8bgao is a user_id of an user.
{id":“api.context.invalid_body_param.app_error”,“message”:“Invalid or missing active in request body”,“detailed_error”:“”,“request_id”:“ms15nct1gf8p8bt1kdnfrzweae”,“status_code”:400}
Thanks a lot prixone. Yes its working with -d ‘{“active”: false}’
Related to per_page=200 it always return 200 even I used per_page=1000. So I have use page=$i,per_page=200 with a loop replacing $i with number starting from 0 till 5(I have around 1000 users) to retrieve all my users.
Well I don’t see any limitations on the code for the use of page and per_page, they are translated directly as limit and offset to the database, so it should give you the 1000 if u do per_page=1000
Maybe curl is not reading the whole response or its splitting? Have you checked if the resulting json is valid? from per_page=1000?
Well I tried on 2 different Ubuntu Systems 14.04 and 16.04 64-bits and the result was same that the curl returned 200 users even though I mentioned ?per_page=1000. Curl is 7.35 version on Ubuntu 14.04 and 7.47 version on Ubuntu 16.04. Do let me know you need any further information.
Curl returned when I used ?per_page=1000
grep -o ‘“id”:’ details.txt | wc -l
200
Curl returned all the users when I mention ?page=1,per_page=200 till page=4,per_page=200
Hi @aholt, you can make multiple requests until you get all the channel members you need
e.g. /api/v4/channels/{channel_id}/members?page=0&per_page=200 , /api/v4/channels/{channel_id}/members?page=1&per_page=200 , and so on until you receive less than 200 results, meaning you’ve hit the end.