---
title: "publishablePublishToCurrentChannel"
description: >
  将资源发布到当前渠道。如果资源是商品，只有在商品状态为活动时才会在渠道中可见。仅限订阅销售的商品（requiresSellingPlan: true）只能在在线商店发布。
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/store-properties/mutations/publishable-publish-to-current-channel'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/store-properties/mutations/publishable-publish-to-current-channel.md'
---
# publishablePublishToCurrentChannel

将资源发布到当前渠道。如果资源是商品，只有在商品状态为活动时才会在渠道中可见。仅限订阅销售的商品（requiresSellingPlan: true）只能在在线商店发布。

- **Required Scopes:** `write_publications`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`PublishablePublishToCurrentChannelPayload`

## Required Permissions

* `write_publications`

接口访问需要令牌，具体如何获取令牌请参考：[身份认证](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md)

## Arguments

* `id`

  [ID!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  需要创建或更新发布的资源。

## Returns

* `shop`

  [Shop!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/store-properties/objects/shop.md)

  表示用户商店的对象。

* `userErrors`

  [[UserError!]!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/user-error.md)

  执行过程中发生的错误列表。

## Code Example

```graphql
mutation publishablePublishToCurrentChannel($id: ID! ) {
	publishablePublishToCurrentChannel(id: $id ) 
		 {
			# PublishablePublishToCurrentChannelPayload fields
		}
		
	}

```

## Variables

```json
{
  "id": {}
}
```

## Examples

### 将资源发布到当前渠道

将资源发布到当前渠道。如果资源是一个商品，那么只有当商品状态为活动时，它才在渠道中可见。仅以订阅方式销售的商品(requiresSellingPlan: true)只能在在线商店上发布。

**Request:**

```json
mutation PublishablePublishToCurrentChannel {
    publishablePublishToCurrentChannel(
        id: "gid://shopline/Product/16055271775622479314742093"
    ) {
        userErrors {
            field
            message
        }
    }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "publishablePublishToCurrentChannel": {
        "userErrors": []
      }
    }
  }
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

