Clojure client implementation for VistarMedia DSP API, including the DSP Reporting API.
See the clojars page for the latest version.
(require '[com.adgoji.vistarmedia :as vistarmedia])
(def client
(vistarmedia/new-client
{::vistarmedia/credential {:email "your@email.com" :password "your-password"}}))
The main entry point is vistarmedia/invoke function, which takes a
client instance and a parameters map, which should have at least
::vistarmedia/op key with a supported operation.
To see the list of available operations, inspect vistarmedia/ops
map.
Example:
(vistarmedia/invoke (client)
{::vistarmedia/op ::vistarmedia/advertiser-get
::vistarmedia/payload
{:id "123456"}})
;; => {:id "123456", :name "adgoji"}
See also documentation for vistarmedia/invoke for additional usage
information.
The DSP Reporting API is served from a separate host
(https://trafficking.vistarmedia.com by default). Reporting
operations are invoked the same way as any other operation, the
client routes them to the reporting host and handles authentication
there:
| Operation | Request |
|---|---|
::vistarmedia/reports-list | GET /reports |
::vistarmedia/report-run | POST /report |
::vistarmedia/report-create-and-save | POST /reports |
::vistarmedia/report-update-and-save | PUT /reports |
(vistarmedia/invoke client
{::vistarmedia/op ::vistarmedia/report-run
::vistarmedia/payload
{:body {:report-type "exchange"
:filters {:advertiser ["123456"]}
:groups ["date" "campaign"]
:metrics ["impressions" "media_cost"]
:local-start "2026-03-22T00:00:00"
:local-end "2026-03-28T23:59:59"
:timezone "Europe/Copenhagen"}}})
Body keys are converted to snake_case, but values are sent as is, so
group and metric names must be given in their API form
(e.g. "media_cost").
To use another environment, pass ::vistarmedia/reporting-url (and
::vistarmedia/base-url for the DSP API) to new-client:
(vistarmedia/new-client
{::vistarmedia/credential {:email "your@email.com" :password "your-password"}
::vistarmedia/reporting-url "https://staging.vistarmedia.com"})
The library is very minimal and basically a small wrapper on top of hato HTTP client. The following features are out of scope:
total-size key, which can
be used to calculate total list of pages to provide proper page
query parameter.new-client and invoke functions accept an
optional wrap-request function, which can be used to wrap requests
into resilience-providing functions.Released under the MIT license: https://opensource.org/license/mit
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |