Browser Targeting (UAS)

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

Description

Use Browser targeting API to deliver the line items for a specific set of browsers.

Important Note:

  1. This API will not validate targetValue  ( i.e. id's for respective targeting ) provided in the POST call.  User should retrieve the valid target details using Common Browser API and provide id's for respective targeting.
  2. User should make sure that same targetValues are not getting included / excluded at same time for same line item.

This API must be called after creating/updating Line Item successfully since it require lineitemId during targeting.

For more information about UAS Line Item Targeting Services, refer to Line Item Targeting Services (UAS) 

Supported Operations 

                     

Method PathHTTP MethodDescriptionLink to Definition
/lineitems/{lineItemId}/targets/browsersPOSTAdd/Update/Remove Browser Targeting for the Line ItemConfigure Browser Targeting
/lineitems/{lineItemid}/targets/browsersGETRetrieve Browser details for a Line ItemRetrieve Targeted Browsers for a Line Item

 

Configure Browser Targeting

Overview

This API enables you to add, update or remove Browser Targeting for a Line Item.

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 NameTypeRequiredValidationsDescriptions
targetLevelNumericYes

Should not be null.

Should not be empty.

This API enables targeting on browsers and not at a more granular level such as in versions. Therefore, the targetLevel will always be  1.

               
Target LevelTargetDescriptionURL for obtaining target level list
1BrowserBrowser Targetinghttp://$URI_PREFIX/api/common/browser
targetValueObject

Yes

Should not be null.

Should not be empty.

Target Value can contain the actual or reference value. It will depend on which target level you are targeting for.

e.g. If you want to target for browser Chrome then targetValue = 5
 

The following are supported data types:

             
Target TypeTarget Value Data TypeReference/Actual Value
BrowserNumericReference Value.  id attribute from the response returned by http://$URI_PREFIX/api/common/browser API
excludeBooleanYes

Default will be false.

Valid values can be true or false.

This value indicates whether the browser to be included / excluded while targeting the Line Item

You can either include or exclude the entities during targeting for given line time for entities at same level. E.g. You can either include or exclude the browsers but not both at time.

Sample Request URL

https://api.pubmatic.com/v1/uas/lineitems/{lineItemId}/targets/browsers/ 

Sample Request JSON

{

    "targets": [{
        "targetLevel": 1,
        "targetValue": 4,
        "exclude": false
    }, {
        "targetLevel": 1,
        "targetValue": 5,
        "exclude": false
    }]
}

 

Sample Response JSON

{
    "entity": {
        "id": {targetid associated with lineitem},
        "isPreset": 0
    },
    "targets": [{
        "targetValue": 4,
        "exclude": false,
        "targetLevel": 1,
        "name": "Opera"
    }, {
        "targetValue": 5,
        "exclude": false,
        "targetLevel": 1,
        "name": "Chrome"
    }]
}

Retrieve Targeted Browsers for a Line Item

Overview

This API enables you to retrieve Browser Targeting for a Line Item.

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 NameTypeRequiredValidationsDescriptions
targetLevelNumericYes

Should not be null.

Should not be empty.

This API enables targeting on browsers and not at a more granular level such as in versions. Therefore, the targetLevel will always be  1.

               
Target LevelTargetDescriptionURL for obtaining target level list
1BrowserBrowser Targeting
http://$URI_PREFIX/api/common/browser
targetValueObject

Yes

Should not be null.

Should not be empty.

Target Value can contain the actual or reference value. It will depend on which target level you are targeting for.

e.g. If you want to target for browser Chrome then targetValue = 5
 

The following are supported data types:

             
Target TypeTarget Value Data TypeReference/Actual Value
BrowserNumericReference Value.  id attribute from the response returned by http://$URI_PREFIX/api/common/browser API
excludeBooleanYes

Default will be false.

Valid values can be true or false.

This value indicates whether the browser to be included / excluded while targeting the Line Item

You can either include or exclude the entities during targeting for given line time for entities at same level. E.g. You can either include or exclude the browsers but not both at time.

Sample Request URL

https://api.pubmatic.com/v1/uas/lineitems/{lineItemId}/targets/browsers/ 

Response

Sample Response JSON

{
    "targets": [{
        "targetValue": 4,
        "exclude": false,
        "name": "Opera"
    }, {
        "targetValue": 5,
        "exclude": false,
        "name": "Chrome"
    }]
}

 

References

HTTP Status Codes 

Error Codes for Browser Targeting

Error codes will be displayed with row information. Row indicates the order of the target object in the request

                                 

Sr. NoError CodesError MessageDescription
1PH_ACCESS_DENIEDAccess DeniedWhen the lineitemid provided does not exist or you don't have access to a line item to perform the edit operation.
2PH_MISSING_OR_INVALID_PARAMETERMissing or Invalid Target ValueWhen any target object contains NULL or an empty target value
3PH_MISSING_OR_INVALID_PARAMETERMissing or Invalid entity id [id] When an invalid Line Item Id is provided in the request
4PH_DUPLICATE_ENTRIES_FOUNDDuplicate targets targetValue [id]When any targetValue is duplicated during the POST request

Attachments

    Outcomes