-
I have a script that has been running on a cronjob without issue up until a couple of weeks ago when it started returning the following error: [{'code': 400, 'message': 'Either IDs or the FQL filter must be provided, not both'}] It uses the Uber class 'indicator.delete.v1' with param'filter':'expired:true'. I also tried using the filter 'filter':f"expiration<'{today}'" as in the code snippet below but getting the same error. Using falconpy ver 0.5.6. Any ideas or suggestions are much appreciated. from falconpy.api_complete import APIHarness
import datetime as dt
falcon_client_id = "[REDACTED]"
falcon_client_secret = "[REDACTED]"
falcon = APIHarness(creds={
'client_id': falcon_client_id,
'client_secret': falcon_client_secret
}
)
today = dt.datetime.today().strftime('%Y-%m-%d')
PARAMS = {
'filter':f"expiration<'{today}'",
'comment':'Delete expired IOCs'
}
response = falcon.command('indicator.delete.v1', parameters=PARAMS)
print(response)
falcon.deauthenticate() |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi @Qbert777 - This is the second report that is pointing out an issue (#311) with this functionality. (This may also be specific to the Uber class.) We're looking into this now. |
Beta Was this translation helpful? Give feedback.
-
Regarding the expiration filter, you need a colon in the filter string. So this:
Should be this: PARAMS = {
'filter':f"expiration:<'{today}'",
'comment':'Delete expired IOCs'
} If you try this using a Service Class, the delete should work. from falconpy.ioc import IOC
import datetime as dt
falcon_client_id = "[REDACTED]"
falcon_client_secret = "[REDACTED]"
falcon = IOC(creds={
'client_id': falcon_client_id,
'client_secret': falcon_client_secret
})
today = dt.datetime.today().strftime('%Y-%m-%d')
response = falcon.indicator_delete(filter=f"expiration:<='{today}'", comment="Delete expired IOCs")
print(response) This does not speak to the Uber class usage issue though, which we are now looking into and tracking as a bug. (#314) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response! I had to add '_v1' to this line in your code for it to work: Strange that the filter "expired:true" returned 200 but it didn't work. Do you have to wrap true in quotes like this "expired:'true'"? Can't try now since I've already deleted my expired IOCs. I will try again tomorrow. Thanks again. |
Beta Was this translation helpful? Give feedback.
Thanks for the quick response! I had to add '_v1' to this line in your code for it to work:
response = falcon.indicator_delete(filter=f"expiration:<='{today}'", comment="Delete expired IOCs")
changed to:
response = falcon.indicator_delete_v1(filter=f"expiration:<='{today}'", comment="Delete expired IOCs")
Strange that the filter "expired:true" returned 200 but it didn't work. Do you have to wrap true in quotes like this "expired:'true'"? Can't try now since I've already deleted my expired IOCs. I will try again tomorrow.
Thanks again.