Intel471Ex. Client
(intel471_ex v0.2.0)
Copy Markdown
HTTP Client for Intel 471 Verity API using Req.
All API requests use HTTP Basic Auth with Verity application credentials (client ID as username, client secret as password).
Summary
Functions
Makes a DELETE request to the Verity API.
Extracts an error message from an API response body.
Makes a GET request to the Verity API.
Makes a raw GET request returning binary response (for file downloads).
Makes a PATCH request to the Verity API with a JSON body.
Makes a POST request to the Verity API with a JSON body.
Makes a PUT request to the Verity API with a JSON body.
Makes an API request to Intel 471 Verity API.
Functions
Makes a DELETE request to the Verity API.
Parameters
path: Full API pathconfig: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, _} = Intel471Ex.Client.delete("integrations/brand-exposure/v1/monitor/monitor-id")
Extracts an error message from an API response body.
Looks for a "message" key in a map response body.
Examples
iex> Intel471Ex.Client.extract_error_message(%{"message" => "Not found"})
"Not found"
iex> Intel471Ex.Client.extract_error_message(%{message: "Unauthorized"})
"Unauthorized"
iex> Intel471Ex.Client.extract_error_message("something else")
nil
Makes a GET request to the Verity API.
Parameters
path: Full API path (e.g.,"integrations/actors/v1/actors/stream")params: Query parameters (optional)config: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, result} = Intel471Ex.Client.get("integrations/actors/v1/actors/stream", %{actor: "conti", size: 10})
Makes a raw GET request returning binary response (for file downloads).
Parameters
path: Full API pathconfig: Optional configuration override
Returns
{:ok, %{body: binary}}— Successful response with raw body{:error, reason}— Error with reason
Examples
{:ok, %{body: pdf}} = Intel471Ex.Client.get_raw("integrations/intel-report/v1/reports/report-id/download-as-pdf")
Makes a PATCH request to the Verity API with a JSON body.
Parameters
path: Full API pathbody: Request body (will be JSON-encoded)config: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, _} = Intel471Ex.Client.patch("integrations/brand-exposure/v1/monitor/monitor-id", %{name: "updated-name"})
Makes a POST request to the Verity API with a JSON body.
Parameters
path: Full API pathbody: Request body (will be JSON-encoded)config: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, monitor} = Intel471Ex.Client.post("integrations/brand-exposure/v1/monitor", %{name: "example.com", targets: ["example.com"]})
Makes a PUT request to the Verity API with a JSON body.
Parameters
path: Full API pathbody: Request body (will be JSON-encoded)config: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, _} = Intel471Ex.Client.put("integrations/watchers/v1/alerts/12345/read", %{})
@spec request(atom(), String.t(), map(), map() | nil, map() | nil) :: {:ok, map()} | {:error, map() | any()}
Makes an API request to Intel 471 Verity API.
Parameters
method: HTTP method (:get, :post, :put, :patch, :delete)path: API endpoint pathparams: Query parameters (optional)body: Request body for POST/PUT/PATCH requests (optional)config: Optional configuration override
Returns
{:ok, body}— Successful response with parsed JSON{:error, reason}— Error with reason
Examples
{:ok, result} = Intel471Ex.Client.request(:get, "integrations/actors/v1/actors/stream", %{size: 10})
{:ok, monitor} = Intel471Ex.Client.request(:post, "integrations/brand-exposure/v1/monitor", %{}, %{name: "test"})