'query for a particular userId within json placeholder

https://jsonplaceholder.typicode.com provides free sample data.

using something like this:

r = requests.get(f'https://jsonplaceholder.typicode.com/todos/{id}')

I can get the todos with a particular id. However, I want to get todos with a particular userId. How is that possible? Is there any way to include that in the query or should I just load all data and then filter out the ones with my desired userIds?

This is how the data looks like: https://jsonplaceholder.typicode.com/todos



Solution 1:[1]

import requests


r = requests.get('https://jsonplaceholder.typicode.com/todos/?userId=4')
print(r.text)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1