-
Notifications
You must be signed in to change notification settings - Fork 9
1. POJOs
Support for passing either object or the JSON string of the source specification is provided in the convert API. The converted request or response is in the same format as the source. For the enhance API, however, an object instance of the source specification needs to be passed. The library has defined a set of pojo classes which are representations of IAB 2.X and 3.0 nomenclature and fields. Each of the objects can be created using no argument constructors and values can be set via simple setters.
//OpenRTB 3.0 bid request example:
OpenRTB3_X openRtb = new OpenRTB3_X();
openRtb.setRequest(new Request());
openRtb.setVer(“3.0”);
//OpenRTB 2.X bid request example:
BidRequest2_X bidRequest = new BidRequest2_X();
bidRequest.setId(“2”);
2.X - The Pojos for 2.5 follow the nomenclature of OpenRTB api specification version 2.5 (link). Library also supports some of the prior versions of 2.X like 2.3(link) and 2.4(link). Root level classes for OpenRtb 2.X -
//Request class
public class BidRequest2_X {
public String id;
public Collection<Imp> imp;
public Site site;
public App app;
public Device device;
public User user;
public Collection<String> badv;
public Integer at;
public Integer test;
public Collection<String> wseat;
public Collection<String> bseat;
public Integer tmax;
public Source source;
public Collection<String> bcat;
public Integer allimps;
public Collection<String> cur;
public Collection<String> wlang;
public Collection<String> bapp;
public Regs regs;
private Map<String, Object> ext;
}
//Response class
public class BidResponse2_X {
private String id;
private Collection<SeatBid> seatbid;
private String bidid;
private String cur;
private String customdata;
private Integer nbr;
private Map<String, Object> ext;
}
3.0 - The Pojos for 3.0 follow the nomenclature of OpenRTB specification version 3.0 (link) and IAB advertising common object model (link). Root level classes for OpenRtb 3.0 -
//Openrtb class
public class OpenRTB3_X {
private String ver = "3.0";
private String domainspec = "adcom";
private String domainver = "1.0";
private Request request;
private Response response;
}
//Request class
public class Request {
private String id;
private Integer test;
private Integer tmax;
private Integer at;
private Collection<String> cur;
private Collection<String> seat;
private Integer wseat;
private String cdata;
private Source source;
private Collection<Item> item;
private Integer pack;
private Context context;
private Map<String, Object> ext;
}
//Response class
public class Response {
private String id;
private String bidid;
private Integer nbr;
private String cur;
private String cdata;
private Collection<Seatbid> seatbid;
private Map<String,Object> ext;
}