# 内容管理

> 使用 Tapjoy Offerwall Reporting API 有效管理您的 Offerwall 配置，例如您的应用、内容卡片、广告位和虚拟货币。

Reporting API 可用于管理内容并查看事件和广告集的配置详细信息。

## 先决条件##prerequisites

您必须通过 API 的身份验证。请参阅 [API 身份验证](/grow/offerwall/monetization/api/api-authentication.md)。

* 如需了解如何通过 Reporting API 获取报告数据，请参阅 [Reporting API - 发行商](/grow/offerwall/monetization/api/reporting-api-publisher.md)。
* 如需了解 Reporting API 的错误处理机制和限制，请参阅 [Reporting API 最佳实践](/grow/offerwall/monetization/api/reporting-api-best-practices.md)。

## 管理应用##manage-your-apps

### 添加应用##add-your-apps

这是您将通过 Offerwall 变现的应用。您还可以在后台中添加应用。如需了解更多信息，请参阅 [Offerwall 设置指南](/grow/offerwall/monetization/getting-started/offerwall-setup-guide.md)。

> **Note:**
>
> 完成此步骤不要求您的应用在 App Store 或 Google Play 应用商店中上线（*storeUrl* 参数是可选参数）。

参考：[createPublisherApp](https://api.tapjoy.com/graphql/docs/mutation/createpublisherapp?category=publishers) 变更

以下突变会创建一个新的发布者 app，无论有没有商店网址。

```graphql
mutation createPublisherAppWithStoreUrl {
  createPublisherApp(input: {
    name: "App Created With Store URL",
    platform: ANDROID,
    storeUrl: "https://play.google.com/store/apps/details?id=com.tapjoy.tapout&gl=us",
    orientation: PORTRAIT
  }) {
    app {
      id
      name
      timezone
      realWorldCurrency
    }
  }
}

mutation createPublisherAppWithoutStoreUrl {
  createPublisherApp(input: {
    name: "App Created WithOUT Store URL",
    platform: ANDROID,
    orientation: PORTRAIT,
    currency: KRW,
    timezone: TOKYO_SEOUL
  }) {
    app {
      id
      name
	  timezone
      realWorldCurrency
    }
  }
}
```

### 查找应用和广告位信息##look-up-app-and-placement-information

查看应用的广告位信息，例如广告位的 Placement ID、内容和描述。

参考：[Publisher#apps](https://api.tapjoy.com/graphql/docs/object/publisher#apps) 字段、[PublisherApp](https://api.tapjoy.com/graphql/docs/object/publisherapp/) 类型

以下查询最多返回 50 个应用程序及其 ID、名称和相关放置/位置详细信息。

```graphql
query {
  publisher{
    apps(first: 50){
      edges{
        node{
          id
          name
          placements{
            id
            name
            mediationName
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
```

响应会返回应用程序及其位置的列表，并带有分页信息来指示是否有更多结果可用。

```graphql
{
  "data": {
    "publisher": {
      "apps": {
        "edges": [
          {
            "node": {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "XXX YYY ZZZ",
              "placements": [
                {
                  "id": "00000000-0000-0000-0000-000000000000",
                  "name": "XXX YYY ZZZ",
                  "mediationName": null
                },
                {
                  "id": "00000000-0000-0000-0000-000000000000",
                  "name": "XXX YYY ZZZ",
                  "mediationName": null
                },
                {
                  "id": "00000000-0000-0000-0000-000000000000",
                  "name": "XXX YYY ZZZ",
                  "mediationName": "ironsource"
                },
                {
                  "id": "00000000-0000-0000-0000-000000000000",
                  "name": "XXX YYY ZZZ",
                  "mediationName": null
                }
              ]
            }
          },
          {
            "node": {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "XXX YYY ZZZ",
              "placements": []
            }
          }
        ],
        "pageInfo": {
          "endCursor": "Mg",
          "hasNextPage": true
        }
      }
    }
  }
}
```

### 查找特定 App ID 的广告位信息##look-up-placement-information-for-a-specific-app-id

参考：[Publisher#placements](https://api.tapjoy.com/graphql/docs/object/publisher#placements) 字段、[Placement](https://api.tapjoy.com/graphql/docs/object/placement/) 类型

以下查询返回指定的app的所有广告位，包括其 ID、名称和聚合名称。

```graphql
query {
  publisher{
    placements(appId: "00000000-0000-0000-0000-000000000000"){
      id
      name
      mediationName
    }
  }
}
```

响应返回为指定 app 配置的放置列表。

```graphql
{
  "data": {
    "publisher": {
      "placements": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "AppLaunch",
          "mediationName": null
        },
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "InsufficientCurrency",
          "mediationName": null
        },
      ]
    }
  }
}
```

## 管理广告位和内容卡片##manage-your-placements-and-content-cards

广告位是应用中可以显示 Offerwall 的特定区域。内容卡片定义了要在给定广告位上显示的广告类型。

### 创建广告位和内容卡片##create-placements-and-content-cards

您可以在后台中创建广告位和内容卡片。如需了解更多信息，请分别参阅[广告位](/grow/offerwall/monetization/dashboard/placements.md)和 [Offerwall 卡片设置](/grow/offerwall/monetization/dashboard/offerwall-cards.md)。

参考：[createPlacementsAndContents](https://api.tapjoy.com/graphql/docs/mutation/createplacementsandcontents?category=publishers) 变更

以下突变将为指定 app 创建新的放置/位置及其关联的内容卡。

```graphql
mutation createPlacementAndContent {
  createPlacementsAndContents(input: {entries: [
    {
      appId: "<PASTE_YOUR_APP_ID_HERE>",
      placementName: "Placement from API"
    }
  ]}) {
    placements {
      id
      name
      description
      contents {
        id
        name
        type
        isSkippable
      }
    }
  }
}
```

### 查找内容卡片配置##look-up-content-card-configuration

查看内容卡片 ID、类型以及任何已配置的 A/B 测试的状态等信息。

参考：[Placement#contents](https://api.tapjoy.com/graphql/docs/object/placement#contents) 字段、[ContentCard](https://api.tapjoy.com/graphql/docs/object/contentcard/) 类型

以下查询返回指定的app的所有广告位及其关联的内容卡。

```graphql
query {
  publisher {
    placements (appId:"00000000-0000-0000-0000-000000000000") {
      id
      name
      contents {
        id
        name
      }
    }
  }
}
```

响应返回每个放置/位置及其配置的内容卡。

```graphql
{
  "data": {
    "publisher": {
      "placements": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "AppLaunch",
          "contents": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "Content for AppLaunch testing by Tapjoy"
            },
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "Content for testing placement by Tapjoy"
            }
          ]
        },
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "InsufficientCurrency",
          "contents": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "Content for InsufficientCurrency testing by Tapjoy"
            },
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "Content for testing placement by Tapjoy"
            }
          ]
        }
      ]
    }
  }
}
```

## 管理虚拟货币##manage-your-virtual-currency

为了使用 Tapjoy 进行变现，需要虚拟货币。您应该提供 App ID、货币名称、兑换比例和成熟时间点。

如需了解更多信息，请参阅[虚拟货币概述](/grow/offerwall/monetization/virtual-currency/virtual-currency-overview.md)。

### 创建虚拟货币##create-virtual-currency

要在 API 中执行此操作，应提供 App ID、货币名称、兑换比例和成熟时间点。还可以在后台中创建虚拟货币。

参考：[createCurrency](https://api.tapjoy.com/graphql/docs/mutation/createcurrency?category=publishers) 变更

以下突变将为指定app创建新的虚拟货币，设置其速率和到期级别。

```graphql
mutation createCurrency {
  createCurrency(input: {
    appId: "<PASTE_YOUR_APP_ID_HERE>",
    name: "New Virtual Currency",
    exchangeRate: 100,
    maturity: MEDIUM
  }) {
    currency {
      id
      name
      exchangeRate
      initialBalance
      maturity
    }
  }
}
```

### 更新虚拟货币##update-a-virtual-currency

还可以使用以下变更来更新虚拟货币。
参考：[updateCurrency](https://api.tapjoy.com/graphql/docs/mutation/updatecurrency?category=publishers) 变更

以下突变会更新现有虚拟货币的名称、到期级别和初始余额。

```graphql
mutation updateCurrency {
  updateCurrency(input: {
    id: "<CURRENCY_ID>",
    maturity: HIGH,
    name: "Shell Bells",
    initialBalance: 100
  }) {
    currency {
      id
      name
      exchangeRate
      initialBalance
      maturity
      callbackUrl
    }
  }
}
```
