Skip to content

Simple DSP(Demand Side Platform) API written in golang

License

Notifications You must be signed in to change notification settings

lsii/go-dsp-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSP API Go implementation

Simple DSP(Demand Side Platform) API written in golang compliant with OpenRTB v2.3

Required middleware

How to setup

If required midllewares were not installed in your machine, please set up and run at first.

Copy source to your local dierctory.

$ git clone [email protected]:satoshi03/go-dsp-api.git

Install go libs and compile.

$ go get
$ go build

Copy config and edit.

$ cp config/config.yml.def config.yml
$ vim config.yml

Run.

$ ./go-dsp-api

End Points

RTB Request [/v1/bid] POST

Receive RTB request. RTB request must be compliant with OpenRTB v2.3

  • Response 200 (application/json)

    • Headers
    x-openrtb-version: 2.3
    
    • Body
    {
        "cur": "JPY", 
        "id": "IxexyLDIIk", 
        "seatbid": [
            {
                "bid": [
                    {
                        "adid": "1234", 
                        "adm": "<a href=\"http://test.noadnolife.com/v1/click/12345?impid=${AUCTION_IMP_ID}&price=${AUCTION_PRICE}\"><img src=\"http://test.noadnolife.com/img/12345?impid=${AUCTION_IMP_ID}&price=${AUCTION_PRICE}\" width=\"728\" height=\"90\" border=\"0\" alt=\"Advertisement\" /></a>", 
                        "cid": "1234", 
                        "crid": "12345", 
                        "id": "d8aa5114-cd86-4484-9947-b907c8d12daa", 
                        "impid": "1", 
                        "iurl": "http://test.noadnolife.com/img/12345.png", 
                        "nurl": "http://test.noadnolife.com/v1/win/12345?impid=${AUCTION_IMP_ID}&price=${AUCTION_PRICE}", 
                        "price": 225
                    }
                ]
            }
        ]
    }
    
  • Response 204 (application/json)

    • Headers
    x-openrtb-version: 2.3
    

Win Notice [/v1/win/:crid] GET

Receive win notice. In order to track logs, price and impression ID are required.

  • Parameters

    • price (number, required) - Won price of RTB Auction
    • impid (number, required) - An impression ID of win notice
  • Response 200 (application/json)

    • Headers
    x-openrtb-version: 2.3
    
    • Body
    { "message": "ok" }
    

Click [/v1/click/:crid] GET

Receive click action log. In order to track logs, price and impression ID are required.

  • Parameters

    • price (number, required) - Won price of RTB Auction
    • impid (number, required) - An impression ID of win notice
  • Response 200 (application/json)

    • Headers
    x-openrtb-version: 2.3
    
    • Body
    { "message": "ok" }
    

Run with mock data

Put mock data to Redis.

$ cd command
$ go run create_mock.go

Send RTB Request via httpie

$ http POST http://<host>/v1/bid < examples/request.mobile.json

Send Win Notice

$ http GET http://<host>/v1/win/XXXX impid==YYYYYYYY price==100

If you want to add/modify mock data, please edit data file.

$ vim command/data.yml

License

See Licence

About

Simple DSP(Demand Side Platform) API written in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%