API Testing of Dynamic Ad Placement Response

API Testing of Dynamic Ad Placement Response

The response being evaluated is a JSON format sent back from a server, which outlines the setup for an advertising module tied to a specific placement (PLACEMENT_100916). This module, known as HTML_MODULE, includes both HTML and JavaScript components to dynamically display an ad on a webpage. The HTML part defines where the ad will show up, while the JavaScript contains an external script URL along with inline code that sets various ad parameters, such as the placement ID, provider info, ad dimensions, refresh options, and tracking headers.

The test script in Postman checks that this response is complete and properly formatted by looking for essential elements, including a successful status code (200), the existence of the main modules object, the accurate setup of PLACEMENT_100916, and specific parameters in the inline JavaScript (like providerParameters for tracking and refresh headers). These tests confirm that the ad configuration is clearly defined and ready for deployment in a live environment.

POST Request

Click to see the whole request (curl)
curl 'https://www.ebay.com/tkt/publish/v2/demand' \
  -H 'accept: application/json' \
  -H 'accept-language: en-US' \
  -H 'content-type: application/json' \
  -H 'cookie: __uzma=878cb023-4e54-4ec5-8e7e-911d4caf36b0; __uzmb=1730663614; __uzme=9329; bm_mi=46A58946AC6558EFF76E4EEDC2229A60~YAAQo1gWAtqIz9OSAQAAoQ+X8xm91xT3xTsVLGOsvu0LWiXlOMXQfVt2/GY7FMmijJ1qcphPRKD7tfCba+wu+aQBT/FuLaIDvi2tfiey2LRTTU2RvIddTcrrNIyV1tbM6bp5iug4v8sfz4qnTHQEBoypSszn2LY4sbuC7bwABK656CrTkYnYY3oGMh7GrHOWCkU9sgUJ8YTLdJUt3GMONd0fPJgBt2HTsSYGr0ZH7M+YiGLa6McC9uZ9TBMAbERprW8Y79SEXXfmhj00EMvyW0gRdQf78gUVfDGVcS2N8qmLsOIknmuY19c1~1; __ssds=2; __ssuzjsr2=a9be0cd8e; __uzmaj2=2a25169a-054c-4ce3-953e-94c5e8062104; __uzmbj2=1730663617; __uzmlj2=x9JJIZjBOjEYxa1PpPw3YvOqEOl+d+u2bVy3nJ1adWU=; ak_bmsc=73A449CD61884B77E4EB69D22BE36173~000000000000000000000000000000~YAAQo1gWAgiJz9OSAQAAOhWX8xkqCkifBjncm9kIX9bfIl4/S2QmGETM2Tnvtt4e8gcV2/fxgmPfO1/dpSMgzASLMqxa6uDVS5ftHkPpM7FQ7XJpMODH91LGM8NXRbJ+2Dy/yEgkyIViPKClPqFZOC6iB/p61BEgCz/JtXPOz/VR5QdCYHdPC7U+UnnaiphV3rwvC0wuVrQhWO4B2x6KHCzANg3fIuloDRBAjpG5jmsoVtk36ly0VbFyWPba1PL8WAgfiCVLIwkB0TNCm0bHj8Vhks2TUZF63jocSUwaq+IrmJ1mSaNesV5tYMUW8JfKe8++A1NARsn0vjuAlv+TmnLYRreqFELepjHHM2346PAT4fvBbzBuTY7fZodKqxhPp6a2qLMwoIfk+/oYQCbJBt9/8eItTI8NaqcxmoSodiroiOnEQyGRC5RpvkFAFgMSDjAq3/6s1O2fQ/rKvq/UoKcX5kn+X4tGFv0s; QuantumMetricSessionID=8530dc2bca02a59e75176745c0bf7f1d; QuantumMetricUserID=011f2bf2f007a47be4b2261efd10120d; __uzmc=190422269794; __uzmd=1730663652; __uzmf=7f60009c8bfb4b-1c97-44d9-90d8-3a6338821cae173066361469337856-aedc13f79ac857a022; __uzmcj2=558181697223; __uzmdj2=1730663654; __uzmfj2=7f60009c8bfb4b-1c97-44d9-90d8-3a6338821cae173066361754437317-7792c4e89c02311316; AMP_f93443b04c=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjIxODk4ZTNkZi0xNjNiLTRhM2EtYmFkZS1lMWIwYzdlMjY5YTklMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzMwNjYzNjE3MjU0JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTczMDY2MzY1Nzc1NSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMyUyQyUyMnBhZ2VDb3VudGVyJTIyJTNBMyU3RA==; ds2=; ebay=%5Ejs%3D1%5Esbf%3D%23000000%5E; s=CgADuABhnKSaUMAZodHRwczovL3d3dy5lYmF5LmNvbS8HAPgAIGcpJoEwNmEyODViNzE5MjBhZDhiODI2OTNiZDRmZmZiMzAwMpz3s2Q*; __deba=7d0wOXEp070prHd_ni1bUjbS9n-WX6uogQo7FzDBbUF2DPP0hxPdhw2b9JJfLC57ekJQIOhbc5I75OlRoskCucDYr0ZZ5uA37RVxrL3LaC7XjewGt31aTZB9utKidkN7yvjgG18RXNfVa5bA3K_Ang==; __gads=ID=6cad0f116648a699:T=1726688174:RT=1730664068:S=ALNI_MYjVfeeuRWiIF4tQHzeauI7BXtuBA; __gpi=UID=00000ef3a681ce28:T=1726688174:RT=1730664068:S=ALNI_MYUctoEC4KbRitmXnQhQcUore8tgg; __eoi=ID=8022a5a0fd293982:T=1726688174:RT=1730664068:S=AA-AfjbYwN_qNjaqfcYl6tsarBna; dp1=bpbf/%23c00020000000000000000069090a96^bl/US6aea3e16^; nonsession=BAQAAAZJU03gwAAaAADMABWkJCpY5NDA0MwDKACBq6j4WMDZhMjg1YjcxOTIwYWQ4YjgyNjkzYmQ0ZmZmYjMwMDIAywACZyfeHjM5q7M47mO3m3aaIrW449J/0MMcMTE*; bm_sv=71922F7F9DD5B76BCAD2BC1B9E8CF375~YAAQJSkSAovQOdOSAQAAWj6g8xlkTmbTYZYMjss0BJFSR7Uq7fYU2GiWk6+8sZbnoq6W1bWXfxmCwDEY5S+ixzwxbpMq/c1Ehi02F2CZ8JH2b40AywI5hRoTXv6dmsM7dz4vJhdFrHLUPFvltQvzgRxFkpWDukhvr/HCNIYohP/yTJLqrr1XQlPCtjZ0Q4VP7kfeWfXfb0GfEaxf6DymwnGL7ihxZvE6WbXQ43eacETXzh+qKVql+3D3z0F6T8k=~1' \
  -H 'origin: https://www.ebay.com' \
  -H 'priority: u=1, i' \
  -H 'referer: https://www.ebay.com/itm/115981801150?_trkparms=amclksrc%3DITM%26aid%3D777008%26algo%3DPERSONAL.TOPIC%26ao%3D1%26asc%3D20240603120050%26meid%3D3842fc7c9fdb4de58d70ec4f39071bdd%26pid%3D102175%26rk%3D1%26rkt%3D1%26itm%3D115981801150%26pmt%3D1%26noa%3D1%26pg%3D4375194%26algv%3DNoSignalMostSearched%26brand%3DCrocs&_trksid=p4375194.c102175.m166538&_trkparms=parentrq%3Af39806f31920a60dbc7e9f2bffffe310%7Cpageci%3A761e2212-9a1d-11ef-a09e-6aa06558150c%7Ciid%3A1%7Cvlpname%3Avlp_homepage' \
  -H 'sec-ch-ua: "Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"' \
  -H 'sec-ch-ua-full-version: "130.0.6723.92"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-model: ""' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-ch-ua-platform-version: "15.0.0"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36' \
  -H 'x-ebay-ads-marketplace-id: EBAY-US' \
  -H 'x-ebay-c-correlation-session: si=06a285b71920ad8b82693bd4fffb3002,operationId=4429486,trk-gflgs=AA**,serviceCorrelationId=01JBST0BBHWDEG4GMS6TDGTSPY' \
  -H 'x-ebay-c-cultural-pref: currency=USD,units=US,locale=en-US,timezone=America%2FLos_Angeles' \
  -H 'x-ebay-c-enduserctx: userAgentAcceptEncoding=gzip,uri=%2Fitm%2F115981801150,userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F130.0.0.0+Safari%2F537.36,contextualLocation=country%3DUS,userAgentAccept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2Cimage%2Favif%2Cimage%2Fwebp%2Cimage%2Fapng%2C*%2F*%3Bq%3D0.8%2Capplication%2Fsigned-exchange%3Bv%3Db3%3Bq%3D0.7,isPiggybacked=false,ip=109.93.197.89,physicalLocation=country%3DUS%2Czip%3D94043,fullSiteExperience=true,referer=https%3A%2F%2Fwww.ebay.com%2F' \
  -H 'x-ebay-c-marketplace-id: EBAY-US' \
  -H 'x-ebay-c-request-id: rci=4Jm0y7LjHomdvlks,ri=PMTy3tGFjdIgKiwf' \
  -H 'x-ebay-c-tracking: guid=06a285b71920ad8b82693bd4fffb3002,pageid=4429486,cobrandId=0' \
  -H 'x-ebay-territory-id: US' \
  --data-raw $'{"impressions":[{"container":{"type":"placement","id":100916,"name":"DT_GF_MREC1_BTF_AVIP","sizes":[{"width":300,"height":250}]},"constraints":{"modules":["HTML_MODULE"]}}],"context":{"view":{"category":{"id":15709},"listings":[{"id":"115981801150","title":"JJJJound X Crocs Classic Clog White - Men\'s Size 11","categories":[{"id":15709}],"formats":{"fixedPrice":{"amount":{"value":79.95,"currency":"USD"}},"bestOffer":false},"seller":{"id":3619770},"nsfwScore":0.0010411718394607306}]},"audiences":[{"id":27720,"name":"NA_SneakerShopper_NonAdidas_InMarketShopper_Last180Days_1stParty"},{"id":24240,"name":"NA_Affluent Quickbooks Customer_Lifestyle_Last365Days_APAudience"},{"id":3084,"name":"NA_FashionShopper_Last30Days_1stParty"},{"id":216,"name":"Adchoice Consent"},{"id":30795,"name":"Seller \u0021= Business"},{"id":10740,"name":"NA_FeelGoodSelfCare_Shopper_Last30Days_1stParty"},{"id":19781,"name":"eBay_AllUsers"},{"id":23171,"name":"NA_NewSellers_Seller_Last90Days_APAudience"},{"id":30544,"name":"NA_SoldLessthan100Items_Seller_Last12Months_1stParty"},{"id":17050,"name":"NA_General_InMarketShopper_Last30Days_1stParty"},{"id":30274,"name":"NA_PrinterInkCartridgeBuyerexcludingCartridges_Last90Days_1stParty"},{"id":21121,"name":"NA_SportsCarShopper_Shopper_Last365Days_1stParty"},{"id":25919,"name":"NA_Generac_InMarketShopper_Last90Days_1stParty"},{"id":29277,"name":"NA_crocs_BrandShopper_Last30Days_1stParty"},{"id":8115,"name":"NA_Call of Duty Shoppers V1_Last360Days_1stParty"},{"id":3438,"name":"NA_GeneralShopper_Last30Days_1stParty"},{"id":17220,"name":"GL_NoPurchase"},{"id":27242,"name":"NA_Quickbooks Converters LAL_Last365Days_1stParty"},{"id":21171,"name":"NA_Medical Supplies_Last365Days_1stParty"},{"id":2526,"name":"NA_ClothingShoesAccessories_InMarketShopper_Last30Days_1stParty"},{"id":30772,"name":"NA_HP2023LaptopCampaignLAL_Custom_1stParty\\t"},{"id":17590,"name":"NA_NewItemShopper_Lifestyle_Last30Days_1stParty"},{"id":30766,"name":"NA_CricketLAL_Custom_Last365Days_APAudience"},{"id":5500,"name":"NA_Clothing, Shoes & Accessories_Men\'s Shoes_InMarketShopper_Last30Days_1stParty"},{"id":30787,"name":"NA_NotViewed_Crocs_Store_Last30days"},{"id":30276,"name":"NA_PrinterInkCartridgeBuyerexcludingCartridges_Last60Days_1stParty"},{"id":8175,"name":"NA_Retro Gamer Shopper_Last360Days_1stParty"},{"id":30247,"name":"NA_DemoHH_Under21_365Days"},{"id":30245,"name":"NA_HHIncomeUnder50K_365Days"}],"privacy":{"adChoice":{"personalized":false}},"ext":{"refresh":true}}}'

Response

{
    "modules": {
        "PLACEMENT_100916": {
            "_type": "HTML_MODULE",
            "html": {
                "type": "HTML",
                "content": "<div id=\"scandal100916\"></div>"
            },
            "js": [
                {
                    "type": "JS_URL",
                    "content": "https://ir.ebaystatic.com/rs/c/scandal/ScandalJS-2.1.79.min.js"
                },
                {
                    "type": "JS_INLINE",
                    "content": "window.scandal.renderAd('scandal100916',{\"placementId\":100916,\"provider\":\"hybrid\",\"providerParameters\":{\"env\":\"production\",\"siteId\":0,\"serviceCorrelationId\":\"01JBST0BBHWDEG4GMS6TDGTSPY\",\"giid\":\"06a285b71920ad8b82693bd4fffb3002\",\"networkId\":\"6245\",\"adUnitId\":\"ebay.ebayus.footer/mrec_first\",\"size\":{\"width\":300,\"height\":250},\"sizes\":[{\"width\":300,\"height\":250}],\"ticket\":\"01JBSTDJK2SSYRRNEEFWC3B8R5\",\"publishType\":2,\"publishDelay\":100,\"refreshCap\":20,\"refreshDelay\":30000,\"isIAS\":false,\"inViewRefresh\":true,\"refreshParameters\":{\"url\":\"https://www.ebay.com/tkt/publish/v2/demand\",\"method\":\"POST\",\"headers\":{\"x-ebay-c-marketplace-id\":\"EBAY-US\",\"x-ebay-territory-id\":\"US\",\"x-ebay-ads-marketplace-id\":\"EBAY-US\",\"Accept\":\"application/json\",\"x-ebay-c-correlation-session\":\"si=06a285b71920ad8b82693bd4fffb3002,operationId=4429486,trk-gflgs=AA**,serviceCorrelationId=01JBSTDJK2R7QCS3HHKJK6NR7M\",\"x-ebay-c-tracking\":\"guid=06a285b71920ad8b82693bd4fffb3002,pageid=4429486,cobrandId=0\",\"x-ebay-c-cultural-pref\":\"currency=USD,units=US,locale=en-US,timezone=America%2FLos_Angeles\",\"x-ebay-c-enduserctx\":\"userAgentAcceptEncoding=gzip,uri=%2Fitm%2F115981801150,userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F130.0.0.0+Safari%2F537.36,contextualLocation=country%3DUS,userAgentAccept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2Cimage%2Favif%2Cimage%2Fwebp%2Cimage%2Fapng%2C*%2F*%3Bq%3D0.8%2Capplication%2Fsigned-exchange%3Bv%3Db3%3Bq%3D0.7,isPiggybacked=false,ip=109.93.197.89,physicalLocation=country%3DUS%2Czip%3D94043,fullSiteExperience=true,referer=https%3A%2F%2Fwww.ebay.com%2F\",\"Content-Type\":\"application/json\",\"x-ebay-c-request-id\":\"rci=PosykbIGmbYtnPZh,ri=3gtlTDPbOj8GcoIC\",\"Accept-Language\":\"en-US\"},\"body\":{\"impressions\":[{\"container\":{\"type\":\"placement\",\"id\":100916,\"name\":\"DT_GF_MREC1_BTF_AVIP\",\"sizes\":[{\"width\":300,\"height\":250}]},\"constraints\":{\"modules\":[\"HTML_MODULE\"]}}],\"context\":{\"view\":{\"category\":{\"id\":15709},\"listings\":[{\"id\":\"115981801150\",\"title\":\"JJJJound X Crocs Classic Clog White - Men's Size 11\",\"categories\":[{\"id\":15709}],\"formats\":{\"fixedPrice\":{\"amount\":{\"value\":79.95,\"currency\":\"USD\"}},\"bestOffer\":false},\"seller\":{\"id\":3619770},\"nsfwScore\":0.0010411718394607306}]},\"audiences\":[{\"id\":27720,\"name\":\"NA_SneakerShopper_NonAdidas_InMarketShopper_Last180Days_1stParty\"},{\"id\":24240,\"name\":\"NA_Affluent Quickbooks Customer_Lifestyle_Last365Days_APAudience\"},{\"id\":3084,\"name\":\"NA_FashionShopper_Last30Days_1stParty\"},{\"id\":216,\"name\":\"Adchoice Consent\"},{\"id\":30795,\"name\":\"Seller != Business\"},{\"id\":10740,\"name\":\"NA_FeelGoodSelfCare_Shopper_Last30Days_1stParty\"},{\"id\":19781,\"name\":\"eBay_AllUsers\"},{\"id\":23171,\"name\":\"NA_NewSellers_Seller_Last90Days_APAudience\"},{\"id\":30544,\"name\":\"NA_SoldLessthan100Items_Seller_Last12Months_1stParty\"},{\"id\":17050,\"name\":\"NA_General_InMarketShopper_Last30Days_1stParty\"},{\"id\":30274,\"name\":\"NA_PrinterInkCartridgeBuyerexcludingCartridges_Last90Days_1stParty\"},{\"id\":21121,\"name\":\"NA_SportsCarShopper_Shopper_Last365Days_1stParty\"},{\"id\":25919,\"name\":\"NA_Generac_InMarketShopper_Last90Days_1stParty\"},{\"id\":29277,\"name\":\"NA_crocs_BrandShopper_Last30Days_1stParty\"},{\"id\":8115,\"name\":\"NA_Call of Duty Shoppers V1_Last360Days_1stParty\"},{\"id\":3438,\"name\":\"NA_GeneralShopper_Last30Days_1stParty\"},{\"id\":17220,\"name\":\"GL_NoPurchase\"},{\"id\":27242,\"name\":\"NA_Quickbooks Converters LAL_Last365Days_1stParty\"},{\"id\":21171,\"name\":\"NA_Medical Supplies_Last365Days_1stParty\"},{\"id\":2526,\"name\":\"NA_ClothingShoesAccessories_InMarketShopper_Last30Days_1stParty\"},{\"id\":30772,\"name\":\"NA_HP2023LaptopCampaignLAL_Custom_1stParty\\t\"},{\"id\":17590,\"name\":\"NA_NewItemShopper_Lifestyle_Last30Days_1stParty\"},{\"id\":30766,\"name\":\"NA_CricketLAL_Custom_Last365Days_APAudience\"},{\"id\":5500,\"name\":\"NA_Clothing, Shoes & Accessories_Men's Shoes_InMarketShopper_Last30Days_1stParty\"},{\"id\":30787,\"name\":\"NA_NotViewed_Crocs_Store_Last30days\"},{\"id\":30276,\"name\":\"NA_PrinterInkCartridgeBuyerexcludingCartridges_Last60Days_1stParty\"},{\"id\":8175,\"name\":\"NA_Retro Gamer Shopper_Last360Days_1stParty\"},{\"id\":30247,\"name\":\"NA_DemoHH_Under21_365Days\"},{\"id\":30245,\"name\":\"NA_HHIncomeUnder50K_365Days\"}],\"privacy\":{\"adChoice\":{\"personalized\":false}},\"ext\":{\"refresh\":true}}}}},\"targetingParameters\":{\"ot\":\"0\",\"if\":\"b\",\"it\":\"JJJJound X Crocs Classic Clog White - Men's Size 11\",\"ap\":\"goober\",\"smdid\":\"6001504015610021555946AAAAAAAAAA\",\"iid\":\"115981801150\",\"cat\":[\"11450\",\"260012\",\"93427\",\"15709\"],\"ccode\":\"USD\",\"ip\":\"29\",\"gdprUser\":\"0\",\"u\":\"4Jm0y7LjHomdvlks/100916\",\"plmtid\":\"100916\",\"kw\":\"JJJJound X Crocs Classic Clog White - Men's Size 11\"}},'default',false,null,true,true,false)"
                }
            ],
            "loading": "WINDOW_LOAD"
        }
    }
}

Test Script

// Parse response JSON
let response = pm.response.json();

// Check that status code is 200
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

// Check if 'modules' object exists
pm.test("Modules object exists", function () {
    pm.expect(response).to.have.property("modules");
});

// Check if 'PLACEMENT_100916' module exists and has the expected structure
pm.test("PLACEMENT_100916 module structure is correct", function () {
    pm.expect(response.modules).to.have.property("PLACEMENT_100916");
    let placementModule = response.modules.PLACEMENT_100916;
    pm.expect(placementModule).to.have.property("_type", "HTML_MODULE");
    pm.expect(placementModule).to.have.property("html");
    pm.expect(placementModule.html).to.have.property("type", "HTML");
    pm.expect(placementModule.html).to.have.property("content", "<div id=\"scandal100916\"></div>");
    pm.expect(placementModule).to.have.property("js").that.is.an("array").with.lengthOf(2);
    pm.expect(placementModule).to.have.property("loading", "WINDOW_LOAD");
});

// Check JS_INLINE content for required parameters
pm.test("JS_INLINE content has necessary parameters", function () {
    let jsInline = response.modules.PLACEMENT_100916.js.find(item => item.type === "JS_INLINE");
    pm.expect(jsInline).to.be.an("object");
    pm.expect(jsInline.content).to.include("scandal100916");
    pm.expect(jsInline.content).to.include("\"placementId\":100916");
    pm.expect(jsInline.content).to.include("\"provider\":\"hybrid\"");
});

// Check refresh parameters contain required headers
pm.test("Refresh parameters contain required headers", function () {
    let refreshParameters = response.modules.PLACEMENT_100916.js.find(item => item.type === "JS_INLINE");
    pm.expect(refreshParameters).to.be.an("object");

    let headers = JSON.parse(refreshParameters.content.match(/"headers":({.*?})/)[1]);
    pm.expect(headers).to.have.property("x-ebay-c-marketplace-id", "EBAY-US");
    pm.expect(headers).to.have.property("x-ebay-territory-id", "US");
    pm.expect(headers).to.have.property("x-ebay-ads-marketplace-id", "EBAY-US");
    pm.expect(headers).to.have.property("Accept", "application/json");
    pm.expect(headers).to.have.property("Content-Type", "application/json");
    pm.expect(headers).to.have.property("Accept-Language", "en-US");
});
Click here to see the test results
TestStatusDescription
Status code is 200PASSThe server responded with a status code of 200, indicating success.
Modules object existsPASSVerified that the ‘modules’ object is present in the response.
PLACEMENT_100916 module structure is correctPASSConfirmed the structure and type of the ‘PLACEMENT_100916’ module.
JS_INLINE content has necessary parametersPASSChecked that the JS_INLINE content includes required parameters for rendering.
Refresh parameters contain required headersPASSEnsured that the refresh parameters contain all necessary headers for the request.

Scroll to Top