openrtb26
Rust types for the OpenRTB 2.6 specification with full serde JSON support.
Features
- Complete coverage of the OpenRTB 2.6 bid request and response objects
- Serialize / deserialize with
serde_jsonout of the box - Spec-correct default values (e.g.
at = 2,cur = "USD",cattax = 1) - Optional fields are skipped when serializing to keep payloads lean
- Unknown fields are silently ignored during deserialization for forward-compatibility
- All types derive
Debug,Clone, andPartialEq
Quick start
Add to your Cargo.toml:
[]
= "0.1"
= "1"
Build a bid request
use ;
let request = BidRequest ;
let json = to_string.unwrap;
Parse a bid response
use BidResponse;
let raw = r#"{
"id": "auction-1234",
"seatbid": [{
"bid": [{
"id": "1",
"impid": "1",
"price": 4.50,
"adm": "<div>ad markup</div>",
"adomain": ["advertiser.com"]
}]
}]
}"#;
let response: BidResponse = from_str.unwrap;
assert_eq!;
Type mapping
All types are re-exported from the crate root for ergonomic imports (use openrtb26::Bid).
| Type | Spec Section | Module |
|---|---|---|
BidRequest |
3.2.1 | lib |
Source |
3.2.2 | source |
Regs |
3.2.3 | source |
Imp |
3.2.4 | imp |
Metric |
3.2.5 | imp |
Video |
3.2.7 | video |
Audio |
3.2.8 | audio |
Native |
3.2.9 | native |
Banner |
3.2.10 | banner |
Format |
3.2.10 | format |
Pmp |
3.2.11 | pmp |
Deal |
3.2.12 | pmp |
Site |
3.2.13 | site |
App |
3.2.14 | site |
Publisher |
3.2.15 | segment |
Content |
3.2.16 | content |
Producer |
3.2.17 | segment |
Device |
3.2.18 | device |
Geo |
3.2.19 | geo |
User |
3.2.20 | segment |
Data |
3.2.21 | segment |
Segment |
3.2.22 | segment |
Network |
3.2.23 | segment |
Channel |
3.2.24 | segment |
SupplyChain |
3.2.25 | supply_chain |
SupplyChainNode |
3.2.25 | supply_chain |
DurFloors |
3.2.26 | source |
Eid |
3.2.27 | eid |
Uid |
3.2.28 | eid |
UserAgent |
3.2.29 | user_agent |
BrandVersion |
3.2.30 | user_agent |
Qty |
3.2.31 | source |
Dooh |
3.2.32 | site |
Refresh |
3.2.33 | segment |
RefSettings |
3.2.34 | segment |
BidResponse |
4.2.1 | lib |
SeatBid |
4.2.2 | seat_bid |
Bid |
4.2.3 | bid |
License
MIT