Content
You are here:
How to set up filters (API)
Added by masayuki ogawa 10 months ago
I'm using the API to get work_packages.
The following documentation describes filters, but it does not work well. https://www.openproject.org/docs/api/endpoints/work-packages/
How do I set this up? (I can get the value if I don't specify filters)
- code
import requests
host_url = "MY_HOST_URL"
api_url = host_url + '/api/v3/'
api_key = "MY_API_KEY"
work_packages_url = api_url + "work_packages"
filters = [{ "start_date": { "operator": ">", "values": ["2024-01-01"] }}] # it's not work.
params = {'pageSize':100, 'offset':0, 'filters':filters}
response = requests.get(work_packages_url, auth=('apikey',api_key), params=params)
data = response.json()
data
- response
{'_type': 'Error',
'errorIdentifier': 'urn:openproject-org:api:v3:errors:InvalidQuery',
'message': "859: unexpected token at 'start_date'"}
Replies (1)
I have the exactly the same problem.
API documentation is lacking.