---
title: "publications"
description: "获取所有 Publication 的列表。"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/apps/queries/publications'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/apps/queries/publications.md'
---
# publications

获取所有 Publication 的列表。

- **Required Scopes:** `read_publications`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`PublicationConnection`

## Required Permissions

* `read_publications`

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

## Arguments

* `before`

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

  返回指定游标之前的元素。如果指定了该参数，也必须要指定 `last` 参数。

* `first`

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

  返回列表中的前 n 个元素。

* `last`

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

  返回列表中的最后 n 个元素。

* `reverse`

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

  是否反转列表的顺序。
  
  ● true：反转
  
  ● false：不反转
  
  默认值：false

* `catalogType`

  [CatalogType](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/enums/catalog-type.md)

  按目录类型过滤Publication。

* `after`

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

  返回指定游标之后的元素。如果指定了该参数，也必须要指定 `first` 参数。

## Returns

* `edges`

  [[PublicationEdge!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/apps/objects/publication-edge.md)

  列表

* `nodes`

  [[Publication!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/apps/objects/publication.md)

  PublicationEdge 中包含的节点列表。

* `pageInfo`

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

  分页信息

## Code Example

```graphql
 {
	publications(before, first, last, reverse, catalogType, after ) 
		 {
			# PublicationConnection fields
		}
}
```

## Examples

### Publications列表

Publications列表。

**Request:**

```json
query Publications {
    publications(first: 2) {
        pageInfo {
            hasNextPage
            hasPreviousPage
            startCursor
            endCursor
        }
        nodes {
            supportsFuturePublishing
            id
            catalog {
                id
                title
                status
                ... on AppCatalog {
                    id
                    title
                    status
                    apps(first: 10) {
                        nodes {
                            appKey
                            id
                            title
                            embedded
                        }
                    }
                }
            }
        }
    }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "publications": {
        "nodes": [
          {
            "catalog": {
              "apps": {
                "nodes": [
                  {
                    "appKey": "0bb53c89feb2c3b8fc0e4fea6991bdc37344127e",
                    "embedded": false,
                    "id": "gid://shopline/App/65094",
                    "title": "WhatsApp"
                  }
                ]
              },
              "id": "gid://shopline/Catalog/21230252",
              "status": "ACTIVE",
              "title": "Channel Catalog 21230251"
            },
            "id": "gid://shopline/Publication/21230251",
            "supportsFuturePublishing": false
          },
          {
            "id": "gid://shopline/Publication/21230257",
            "supportsFuturePublishing": false,
            "catalog": {
              "apps": {
                "nodes": [
                  {
                    "embedded": false,
                    "id": "gid://shopline/App/65095",
                    "title": "Facebook",
                    "appKey": "111afe2f9baceb93004af92b1276582619f1db26"
                  }
                ]
              },
              "id": "gid://shopline/Catalog/21230258",
              "status": "ACTIVE",
              "title": "Channel Catalog 21230257"
            }
          }
        ],
        "pageInfo": {
          "endCursor": "eyJsYXN0X2lkIjoyMTIzMDI1NywibGFzdF92YWx1ZSI6IjIxMjMwMjU3In0=",
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "eyJsYXN0X2lkIjoyMTIzMDI1MSwibGFzdF92YWx1ZSI6IjIxMjMwMjUxIn0="
        }
      }
    }
  }
}
```

## 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)。

