Device Type Targeting (UAS)

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

Description

You can use Device Type Targeting API to deliver the line items on type of device like feature phone, smart phone etc.

Important Note:

  1. This API will not validate targetValue  ( i.e. id's for respective targeting ) provided in the POST call.  Retrieve the valid target details using Common Mobile Device Type API and provide id's for respective targeting.
  2. Make sure that the 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/devicetypesPOSTAdd/Update/Remove Device Type Targeting for the Line Item LevelConfigure Device Type Targeting
/lineitems/{lineItemId}/targets/devicetypesGETRetrieve Device Type Targeting Details for a Line ItemRetrieve Targeted Device Type for a Line Item

 

Configure Device Type Targeting

Overview

This API enables you to add, update or remove Device Type for a Line Item.

Request

           

URIHTTP Method
https://api.pubmatic.com/v1/uas/lineitems/{lineItemId}/targets/devicetypes/POST

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

This API accepts array of target objects, where each object must contain following attributes.

                               

Parameter NameTypeRequiredValidationsDescriptions
targetLevelNumericYes

Should not be null.

Should not be empty.

Device Type has only a single target level

The following are the valid Target Levels for Device Type targeting:

               
Target LevelTargetDescriptionURL for obtaining target level list
1Device TypeDevice Type Targeitng

You can retrieve all supported OS details using following URL

http://$URI_PREFIX/api/common/mobileDeviceType

targetValueNumeric

Yes

Should not be null.

Should not be empty.

Target Value can contain a reference value.e.g., To target a Device Type Tablet then targetValue=2

The following are supported data types:

             
Target TypeTarget Value Data TypeReference/Actual Value
Device TypeNumericReference Value.  id attribute from the response returned Common API
excludeBooleanYes

Default will be false.

Valid values can be true or false.

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

Sample Request URL

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

 

Sample Request JSON

 

    

{
    "targets": [
        {
            "targetValue": 1,
            "exclude": true,
            "targetLevel": 1
        },
        {
            "targetValue": 2,
            "exclude": true,
            "targetLevel": 1
        }
    ]
}

Sample Request JSON: Remove Device Type Targeting for a LIne Item

    

{
    "targets": []
}

 

Response

Sample Response JSON

    

{
  "entity": {
    {
        targetid associated with lineitem},
        "isPreset": 0
},
  "targets": [
    {
      "targetValue": 1,
      "exclude": true,
      "targetLevel": 1,
      "deviceTypeId": 1,
      "deviceType": "Feature Phone"
    },
    {
      "targetValue": 2,
      "exclude": true,
      "targetLevel": 1,
      "deviceTypeId": 2,
      "deviceType": "Smart Phone"
    }
  ]
}

 

Retrieve Targeted Device Type for a Line Item

 

Overview

This API enables you to retrieve Device Type 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

This API accepts array of target objects, where each object must contain following attributes

                               

Parameter NameTypeRequiredValidationsDescriptions
targetLevelNumericYes

Should not be null.

Should not be empty.

Device Type has only a single target level

The following are the valid Target Levels for Device Type targeting:

               
Target LevelTargetDescriptionURL for obtaining target level list
1Device TypeDevice Type Targeitng

You can retrieve all supported OS details using following URL

http://$URI_PREFIX/api/common/mobileDeviceType

targetValueNumeric

Yes

Should not be null.

Should not be empty.

Target Value can contain a reference value.e.g., To target a Device Type Tablet then targetValue=2

The following are supported data types:

             
Target TypeTarget Value Data TypeReference/Actual Value
Device TypeNumericReference Value.  id attribute from the response returned Common API
excludeBooleanYes

Default will be false.

Valid values can be true or false.

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

Sample Request URL

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

Response

Sample Response JSON    

{
    "targets": [
        {
            "targetValue": 1,
            "exclude": true,
            "deviceTypeId": 1,
            "deviceType": "Feature Phone"
        },
        {
            "targetValue": 2,
            "exclude": true,
            "deviceTypeId": 2,
            "deviceType": "Smart Phone"
        }
    ]
}

Error Codes For Device Type Targeting

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

                           

Sr. NoError CodesError MessageDescription
1.PH_MISSING_OR_INVALID_PARAMETERMissing or Invalid Target ValueWhen any target object contains NULL or an empty target value
2.PH_MISSING_OR_INVALID_PARAMETER_MSGMissing or Invalid Target LevelWhen any target object contains NULL or an empty target level
3.PH_MISSING_OR_INVALID_PARAMETERMissing or Invalid entity id [ ]When an Invalid Line item Id is provided in the request

 

 

Unified Ad Server References

Common Request Query Parameters for Web Services

Supported Operations for Filters

HTTP Status Codes

Unified Ad Server Specific Error Codes

Attachments

    Outcomes