Skip to content

[BUG] Action creation fails with 500 server error #215

@hovhanns

Description

@hovhanns

**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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions