Skip to content

Commit cbca969

Browse files
authored
Merge pull request carbonblack#207 from carbonblack/issue-202
Fix carbonblack#202 by overriding URL when performing non-GET requests
2 parents 30d0c56 + 907a76e commit cbca969

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cbapi/response/models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,17 @@ def feed(self):
308308
def trigger_ioc(self):
309309
return self.ioc_attr
310310

311+
# override the Alert API URL to /api/v1/alert when performing POST/PUTs
312+
def _build_api_request_uri(self, http_method="GET"):
313+
if http_method == "GET":
314+
return super(Alert, self)._build_api_request_uri(http_method)
315+
else:
316+
baseuri = "/api/v1/alert"
317+
if self._model_unique_id is not None:
318+
return baseuri + "/%s" % self._model_unique_id
319+
else:
320+
return baseuri
321+
311322

312323
class Feed(MutableBaseModel, CreatableModelMixin):
313324
swagger_meta_file = "response/models/feed.yaml"

0 commit comments

Comments
 (0)