---
title: "automaticDiscountNodes"
description: "查询自动折扣列表"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/discounts-and-marketing/queries/automatic-discount-nodes'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/discounts-and-marketing/queries/automatic-discount-nodes.md'
---
# automaticDiscountNodes

查询自动折扣列表

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

## Type Signature

`DiscountAutomaticNodeConnection`

## Required Permissions

* `read_discounts`

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

## Arguments

* `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

* `query`

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

  对查询应用一个或多个过滤器。
  当前支持过滤字段及可选值
  - status：表示活动状态，可选择值：active（启用状态），expired（过期状态），scheduled（待开始状态）
  - type：表示折扣类型，fix_amount（减金额），percentage（减百分比折扣）
   
  
  实例:查询减固定金额启用状态自动折扣活动，如下：
  
  `query:"type:fix_amount AND status:active"`
  

* `sortKey`

  [AutomaticDiscountSortKeys](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/discounts-and-marketing/enums/automatic-discount-sort-keys.md)

  自动折扣列表查询的有效排序键集
  可选择枚举值
  - CREATED_AT 按创建时间排序
  - ID 按ID排序
  

* `after`

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

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

* `before`

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

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

## Returns

* `edges`

  [[DiscountAutomaticNodeEdge!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-automatic-node-edge.md)

  列表的边界

* `nodes`

  [[DiscountAutomaticNode]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-automatic-node.md)

  DiscountAutomaticNodeEdge 中包含的节点列表

* `pageInfo`

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

  分页的帮助信息。

## Code Example

```graphql
 {
	automaticDiscountNodes(first, last, reverse, query, sortKey, after, before ) 
		 {
			# DiscountAutomaticNodeConnection fields
		}
}
```

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

