cbapi-python icon indicating copy to clipboard operation
cbapi-python copied to clipboard

[BUG] Action creation fails with 500 server error

Open hovhanns opened this issue 5 years ago • 1 comments

**I am seeing this behaviour on: **

  • OS: Ubuntu
  • Carbon Black Product: CBResponse
  • Python Version: 2.7

Describe the bug CBapi uses the old version of API to create action for watchlist POST /api/v1/watchlist//action { "action_type":3, "watchlist_id": } this API is deprecated and throws internal server error

Steps to Reproduce

    watchlist = cb_api.create(Watchlist, data={"name": name, "index_type": watchlist_type})

    watchlist.query = search_query

    watchlist.save()

    alert_action = watchlist.create_action()

    alert_action.action_type = 3  # Create alert on detection

    alert_action.watchlist_id = watchlist.id

    alert_action.save()

run this code, it raises exception cbapi.errors.ServerError: Received error code 500 from API: Unhandled exception. Check logs for details.

Expected behavior Should create alert action without error

Additional context

The part in the code need to changed src/cbapi/response/models.py 471:473, here is used the deprecated REST api calls

hovhanns avatar Jan 31 '20 15:01 hovhanns

I'm experiencing the same issue

nguyenl95 avatar Mar 02 '20 10:03 nguyenl95