---
title: "companyLocations"
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/b-2-b/queries/company-locations'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/queries/company-locations.md'
---
# companyLocations

公司地点列表查询

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Arguments

* `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` 参数。

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

* `sortKey`

  [CompanyLocationSortKeys](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/enums/company-location-sort-keys.md)

  排序规则

* `rawQuery`

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

  查询条件，json字符串。
  当前仅支持地点名称或公司id查询，例如`{"companyId": "643266524357","name": "Golden Street Location"}`

## Returns

* `edges`

  [[CompanyLocationEdge!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/objects/company-location-edge.md)

  edges列表

* `nodes`

  [[CompanyLocation]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/objects/company-location.md)

  节点列表

* `pageInfo`

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

  分页信息

## Examples

### 地点列表查询

分页查询地点列表信息

**Request:**

```json
query {
  companyLocations(first: 2, rawQuery: "{\"name\": \"location\"}",after:null,before:null,reverse:true,sortKey: CREATED_AT) {
    edges {
      cursor
      node {
        id
        name
        orderCount
        totalSpent {
            amount
            currencyCode
        }
        billingAddress {
          id
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      shippingAddress {
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      company {
        id
        name
        }
      }
    }
    nodes {
        id
        name
        orderCount
        totalSpent {
            amount
            currencyCode
        }
        billingAddress {
          id
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      shippingAddress {
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      company {
        id
        name
        }
    }
    pageInfo {
        endCursor
        hasNextPage
        hasPreviousPage
        startCursor
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "companyLocations": {
        "nodes": [
          {
            "orderCount": 0,
            "shippingAddress": {
              "address1": "funny street",
              "address2": "golden 3 department",
              "country": null,
              "province": null,
              "zip": "53118",
              "city": "Ottawa",
              "countryCode": "CA",
              "createdAt": "2024-06-03T02:26:44.806Z",
              "id": "gid://shopline/CompanyAddress/************1447"
            },
            "totalSpent": {
              "amount": "0",
              "currencyCode": "USD"
            },
            "billingAddress": {
              "province": null,
              "zip": "53118",
              "address1": "fake street",
              "city": "Ottawa",
              "country": null,
              "id": "gid://shopline/CompanyAddress/************4520",
              "address2": "long three department",
              "countryCode": "CA",
              "createdAt": "2024-06-03T02:26:44.848Z"
            },
            "company": {
              "id": "gid://shopline/Company/************0599",
              "name": "Y*****"
            },
            "id": "gid://shopline/CompanyLocation/************886",
            "name": "Top catagory location"
          },
          {
            "billingAddress": {
              "address2": "long three department",
              "city": "Ottawa",
              "country": null,
              "countryCode": "CA",
              "id": "gid://shopline/CompanyAddress/************624",
              "address1": "fake street",
              "createdAt": "2024-05-14T10:26:15.695Z",
              "province": null,
              "zip": "53118"
            },
            "company": {
              "id": "gid://shopline/Company/************599",
              "name": "Big bom"
            },
            "id": "gid://shopline/CompanyLocation/************454",
            "name": "Top catagory location",
            "orderCount": 0,
            "shippingAddress": {
              "id": "gid://shopline/CompanyAddress/************551",
              "province": null,
              "address2": "golden 3 department",
              "city": "Ottawa",
              "countryCode": "CA",
              "zip": "53118",
              "address1": "funny street",
              "country": null,
              "createdAt": "2024-05-14T10:26:15.653Z"
            },
            "totalSpent": {
              "amount": "0",
              "currencyCode": "USD"
            }
          }
        ],
        "pageInfo": {
          "endCursor": "E002CE0E792FBA4E98672D39851FDFD6",
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "AF52536A1951B28A30AAE8825A2B69B9"
        },
        "edges": [
          {
            "cursor": "-",
            "node": {
              "id": "gid://shopline/CompanyLocation/************8886",
              "name": "Top catagory location",
              "orderCount": 0,
              "shippingAddress": {
                "address2": "golden 3 department",
                "country": null,
                "createdAt": "2024-06-03T02:26:44.806Z",
                "zip": "53118",
                "address1": "funny street",
                "city": "Ottawa",
                "countryCode": "CA",
                "id": "gid://shopline/CompanyAddress/************01447",
                "province": null
              },
              "totalSpent": {
                "amount": "0",
                "currencyCode": "USD"
              },
              "billingAddress": {
                "address2": "long three department",
                "country": null,
                "province": null,
                "zip": "53118",
                "city": "Ottawa",
                "countryCode": "CA",
                "createdAt": "2024-06-03T02:26:44.848Z",
                "id": "gid://shopline/CompanyAddress/************4520",
                "address1": "fake street"
              },
              "company": {
                "id": "gid://shopline/Company/************50599",
                "name": "S****"
              }
            }
          },
          {
            "cursor": "-",
            "node": {
              "billingAddress": {
                "zip": "53118",
                "address2": "long three department",
                "country": null,
                "countryCode": "CA",
                "createdAt": "2024-05-14T10:26:15.695Z",
                "address1": "fake street",
                "city": "Ottawa",
                "id": "gid://shopline/CompanyAddress/************624",
                "province": null
              },
              "company": {
                "id": "gid://shopline/Company/************599",
                "name": "T****"
              },
              "id": "gid://shopline/CompanyLocation/************0454",
              "name": "Top catagory location",
              "orderCount": 0,
              "shippingAddress": {
                "address1": "funny street",
                "country": null,
                "createdAt": "2024-05-14T10:26:15.653Z",
                "id": "gid://shopline/CompanyAddress/************4551",
                "province": null,
                "address2": "golden 3 department",
                "city": "Ottawa",
                "countryCode": "CA",
                "zip": "53118"
              },
              "totalSpent": {
                "amount": "0",
                "currencyCode": "USD"
              }
            }
          }
        ]
      }
    }
  }
}
```

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

