Ad Tag API (UAS)

Document created by pubmatic-archivist on Mar 27, 2017Last modified by catherine.racette on Aug 28, 2017
Version 5Show Document
  • View in full screen mode

Description

The Ad Tag API allows you to generate the Ad Tag based on given parameters.

For more information about UAS Inventory Management Services APIs, refer to Inventory Management Services (UAS) 

Supported Operations

Service Name: /adtags/

               

Method PathHTTP Method TypeDescriptionLink to Definition
/adtags/generate/adunit/{id}?adUnitFormats={id}GET

Generates an Ad Tag based on parameters (Ad Unit Id and Ad Format Id).

Supported Ad Unit Formats:

  • 3 = Banner/Rich Media
  • 12 = Native
  • 13 = Video 
Generate an Ad Tag

 

Generate an Ad Tag

 

Overview

This API enables you to generate an Ad Tag based on the parameters provided.

Request

           

Request Headers

                        

Header nameType ValueRequiredDescription
Content-TypeStringapplication/jsonYesMedia type for request.
pubTokenString${access_token}Yes

Publisher Token to authenticate and authorize the user calling the Unified Ad Server API. Send the access token generated for authentication at the place of ${access_token} in the request.

 

For more information about access tokens, refer to Getting Started with PubMatic APIs.

Request Body Parameters

                        

Parameter NameTypeRequiredValidationDescription
adUnitFormatNumericYesShould be valid and exist in the systemAd Unit Format of an ad unit for which the ad tag is generated. You can retrieve Ad Unit Format using Ad Format API.
generateSecureTagBooleanNoDefault is false.Pass true if you would like to have a secure Ad Tag to be set up on secured pages for provided Ad Unit Format; otherwise, pass false.

Request Sample URL

https://api.pubmatic.com/v1/uas/adtags/generate/adunit/1?adUnitFormats=3 

Response

If the ad unit format is native, the response, along with native ad tag, will have RTB JSON for all native templates associated with that ad unit, as the native template name as key and RTB Request JSON as value.

Sample Response JSON: Non-Native

 

    

{
  "DISPLAY": {
    "tag": {
      "head": "<!-- Part 1 -->\r\n<!-- Head section, should be included only once on a page
-->\r\n<script type='text/javascript'>\r\n   \tvar Phoenix = {};\r\n\tPhoenix.EQ = [];
\r\n\t(function(){\r\n\t\tvar scriptElement = document.createElement('script');\r\n\t\
tscriptElement.async = true;\r\n\t\tscriptElement.type = 'text/javascript';\t\t\r\n\t\
tscriptElement.src = ('https:' == document.location.protocol ? 'https:' : 'http:') +
'//ads.pubmatic.com/AdServer/js/phoenix.js';\r\n\t\tvar node = document.getElementsByTagName
('script')[0];\r\n\t\tnode.parentNode.insertBefore(scriptElement, node);\t\t\t\t\r\n\t})
();\r\n</script>\r\n<!-- Part 2 -->\r\n<!-- AdSlot declaration section, will repeat for
number of slots -->\r\n<script type='text/javascript'>\r\n\tPhoenix.EQ.push
(\r\n\t\tfunction(){\r\n\t\t\tPhoenix.enableSingleRequestCallMode();\r\n\t\t\
tPhoenix.defineAdSlot('929',[],'Div_ID_To_Render_This_Slot');\t\t\t\r\n\t\t}\r\n\t);
\t\r\n</script>\r\n",
      "body": "<!-- Part 3 -->\r\n<!-- Document Body, This part should be added where
adSlot is expected to render creative  -->\r\n<div id='Div_ID_To_Render_This_Slot'>\r\n\t
<script type='text/javascript'>\r\n\t\tPhoenix.EQ.push(\r\n\t\t\tfunction(){\r\n\t\t\t\
tPhoenix.display('Div_ID_To_Render_This_Slot');\r\n\t\t\t}\r\n\t\t);\t\r\n\t</script>
\r\n</div>\r\n"
    }
  }
}

Sample Response JSON: Native

    


{
  "NATIVE": {
    "tag": "http://adserverbeta.pubmatic.com/ad?&req_type=4&res_format=2&au=929&ntid=
<NATIVE_TEMPLATE_ID>&iid=<IMPRESSION_ID>&rndn=<RANDOM_NUMBER_CACHE_BURSTING>\n\t\n",
    "templateRequestJsonMap": {
      "Test-AdTemplate-001-Apps": "{\"assets\":[{\"id\":1,\"required\":1,\"img\":null,
\"title\":{\"len\":100},\"data\":null,\"video\":null},{\"id\":2,\"required\":1,\"img\"
:{\"type\":1,\"wmin\":null,\"hmin\":null,\"mimes\":[\"image/png\"],\"aspect_ratio\":null,
\"w\":75,\"h\":75},\"title\":null,\"data\":null,\"video\":null},{\"id\":3,\"required\":1,
\"img\":{\"type\":3,\"wmin\":null,\"hmin\":null,\"mimes\":[\"image/png\"],\"aspect_ratio\
"
:null,\"w\":480,\"h\":320},\"title\":null,\"data\":null,\"video\":null},{\"id\":4,
\"required\":1,\"img\":null,\"title\":null,\"data\":{\"type\":2,\"len\":200},\"video\
"
:null},{\"id\":5,\"required\":1,\"img\":null,\"title\":null,\"data\":{\"type\":3,\"len\
"
:10},\"video\":null}],\"adunit_id\":null,\"layout_id\":null}"
    }
  }
}

 

 

Unified Ad Server References

Common Request Query Parameters for Web Services

Supported Operations for Filters

HTTP Status Codes

Unified Ad Server Specific Error Codes

 

 

Version 9

Attachments

    Outcomes