Publishers: Upgrade Guide

For upgrading from Publisher Reporting APIs, a migration path is described below.

Upgrading from Publisher Reporting API

The Publisher Reporting API is a REST API for retrieving metrics about publisher data. To upgrade from the Publisher Reporting API, modify your endpoint from https://api.tapjoy.com//v2/publisher/reports to https://api.tapjoy.com/graphql. The authorization process remains the same.

Requests with group_by by placements

The group_by=placements parameter used in requests to the Publisher Reporting API has an equivalent in the GraphQL API as shown below:

GET /v2/publisher/reports?date=2021-09-22&group_by=placements
Host: api.tapjoy.com
Authorization: Bearer <OAuth Token>
{
    "Date": "2021-09-22",
    "TotalApps": 1,
    "PageSize": 1,
    "TotalPages": 1,
    "CurrentPage": 1,
    "Apps": [
        {
            "Name": "MyTapjoy",
            "Platform": "iphone",
            "AppKey": "00000000-0000-0000-0000-000000000000",
            "Placements": [
                {
                    "Name": "offerwall_unit",
                    "Global": {
                        "Revenue": 0.0,
                        "Impressions": 6.0,
                        "Clicks": 4.0,
                        "Conversions": 1.0,
                        "DUV": 1.0,
                        "DUC": 1.0,
                        "ECPM": 0.0
                    },
                    "Countries": [
                        {
                            "Country": "us",
                            "Revenue": 0.0,
                            "Impressions": 6.0,
                            "Clicks": 4.0,
                            "Conversions": 1.0,
                            "DUV": 1.0,
                            "DUC": 1.0,
                            "ECPM": 0.0
                        }
                    ]
                }
            ]
        }
    ]
}

...would get translated to the following query / response in the GraphQL API:

query {
  publisher{
    placements(appId: "00000000-0000-0000-0000-000000000000") {
      id
      name
      contents {
        id
        name
        type
        ecpmSettings {
          country
          cpmFloorType
          price
        }
      }
      insights(timePreset: TODAY) {
        reports {
          clicks
          conversions
          impressions
          dailyUniqueViewers
          dailyUniqueConversions
          earnings
        }
        timestamps
      }
    }
  }
}
{
  "data": {
    "publisher": {
      "placements": [    
       {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "offerwall_unit",
          "contents": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "Offerwall (Offerwall+)",
              "type": "OFFERWALL",
              "ecpmSettings": [
                {
                  "country": "US",
                  "cpmFloorType": "BALANCED",
                  "price": 5
                }
              ]
            },
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "offerwall_plus",
              "type": "OFFERWALL",
              "ecpmSettings": [
                {
                  "country": "US",
                  "cpmFloorType": "BALANCED",
                  "price": 5
                }
              ]
            },
          ],
          "insights": {
            "reports": [
              {
                "clicks": [
                  4
                ],
                "conversions": [
                  1
                ],
                "impressions": [
                  6
                ],
                "dailyUniqueViewers": [
                  1
                ],
                "dailyUniqueConversions": [
                  1
                ],
                "earnings": [
                  0
                ]
              }
            ],
            "timestamps": [
              "2021-09-22T00:00:00Z"
            ]
          }
        }
      ]
    }
  }
}

Requests with group_by by content_cards

The group_by=content_cards parameter used in requests to the Publisher Reporting API has an equivalent in the GraphQL API as shown below:

GET /v2/publisher/reports?date=2021-09-22&group_by=content_cards
Host: api.tapjoy.com
Authorization: Bearer <OAuth Token>
{
    "Date": "2021-09-22",
    "TotalApps": 1,
    "PageSize": 1,
    "TotalPages": 1,
    "CurrentPage": 1,
    "Apps": [
        {
            "Name": "MyTapjoy",
            "Platform": "iphone",
            "AppKey": "00000000-0000-0000-0000-000000000000",
            "ContentCards": [
                {
                    "Name": "offerwall_plus",
                    "Type": "Offerwall",
                    "PlacementNames": [
                        "offerwallplus_unit",
                        "owp",
                        "offerwall_unit",
                        "ow2"
                    ],
                    "Global": {
                        "Revenue": 0.0,
                        "Impressions": 6.0,
                        "Clicks": 4.0,
                        "Conversions": 1.0,
                        "DUV": 1.0,
                        "DUC": 1.0,
                        "ECPM": 0.0
                    },
                    "Countries": [
                        {
                            "Country": "us",
                            "Revenue": 0.0,
                            "Impressions": 6.0,
                            "Clicks": 4.0,
                            "Conversions": 1.0,
                            "DUV": 1.0,
                            "DUC": 1.0,
                            "ECPM": 0.0
                        }
                    ]
                }
            ]
        }
    ]
}

...would get translated to the following query / response in the GraphQL API:

query {
  publisher{
    placements(appId: "00000000-0000-0000-0000-000000000000") {
      id
      name
      contents {
        id
        name
        type
        ecpmSettings {
          country
          cpmFloorType
          price
        }
        insights(timePreset: TODAY) {
          reports {
            clicks
            conversions
            impressions
            dailyUniqueViewers
            dailyUniqueConversions
            earnings
          }
          timestamps
        }
      }
    }
  }
}
{
    "data": {
        "publisher": {
            "placements": [
                {
                    "id": "00000000-0000-0000-0000-000000000000",
                    "name": "offerwall_unit",
                    "content": {
                        "id": "00000000-0000-0000-0000-000000000000",
                        "name": "offerwall_plus",
                        "type": "OFFERWALL",
                        "ecpmSettings": [
                            {
                                "country": "US",
                                "cpmFloorType": "BALANCED",
                                "price": 5.0
                            }
                        ],
                        "insights": {
                            "reports": [
                                {
                                    "clicks": [
                                        4
                                    ],
                                    "conversions": [
                                        1
                                    ],
                                    "impressions": [
                                        6
                                    ],
                                    "dailyUniqueViewers": [
                                        1
                                    ],
                                    "dailyUniqueConversions": [
                                        1
                                    ],
                                    "earnings": [
                                        0
                                    ]
                                }
                            ],
                            "timestamps": [
                                "2021-09-22T00:00:00Z"
                            ]
                        }
                    }
                }
            ]
        }
    }
}

Request with group_by by content_types

The upgrade for this specific grouping feature is not available. The content types usually refer to iOS or Android. It can be inferred through another field and grouped accordingly. Here, we support grouping by content cards (as explained above), and content cards are platform specific. So, in order to separate results by iOS vs Android, a user should do their own parsing of a query where they group_by content cards.