jwogrady Posted July 14, 2023 Report Share Posted July 14, 2023 I'm using Python's request library to query the API. The documentation doesn't show what a paramatized filtering url would look like. For example, https://source-docs.blesta.com/class-Services.html#_getList The filter variable is supposed to be passed as an array. #getList( integer $client_id = null, string $status = 'active', integer $page = 1, array $order_by = ['date_added' => 'DESC'], boolean $children = true, array $filters = [] ) Returns a list of services for the given client and status Using python requests, that would be done like this.... def services_getAllByClient(): data = request( 'services/', 'getlist', blesta_format, params={'client_id': 741, 'filters': ['package_id', 112]} ) print(data.url) >>> app.services_getAllByClient() https://[myblestainstall.com]/api/services/getlist.json?client_id=741&filters=package_id&filters=112 It's not filtering.... What would correct paramaratized files look like? Quote Link to comment Share on other sites More sharing options...
smithsteve Posted November 10 Report Share Posted November 10 An example of an API URL with a filter would look like this: arduino https://api.example.com/items?category=books&price_min=10&price_max=50 In this example: category=books filters items by category. price_min=10 filters items with a price of at least 10. price_max=50 filters items with a price no higher than 50. Filters are typically added as query parameters in the URL after the ?. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.