---
title: "更新承运商服务"
description: "更新指定运营商服务。只有创建运营商服务的应用才可以更新它。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/order/shipping-and-fulfillment/carrier-service/modify-an-existing-carrier-service'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/order/shipping-and-fulfillment/carrier-service/modify-an-existing-carrier-service.md'
---
# 更新承运商服务

更新指定运营商服务。只有创建运营商服务的应用才可以更新它。

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_shipping`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
PUT /carrier_services/:carrier_service_id.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `write_shipping`

## Request

### Path Parameters

* `carrier_service_id`

  string (required)

  承运商服务ID

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

### Request Body

* `carrier_service`

  object

  承运商服务信息

  * `active`

    boolean

    承运商服务是否激活

  * `service_name`

    string

    运输服务名称

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `carrier_service`

  object

  承运商服务信息

  * `callback_url`

    string

    请求计算运费所需的 URL，必须是公网 URL。

  * `carrier_service_type`

    string

    用于区别API运费和商家运费

  * `id`

    string

    承运商服务的ID

  * `name`

    string

    运输服务名称

  * `service_discovery`

    boolean

    商家是否能够通过 Shopline 后台承运商服务发送虚拟数据以查看运费示例

  * `active`

    boolean

    承运商服务是否激活


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "description": "更新指定运营商服务。只有创建运营商服务的应用才可以更新它。",
  "externalDocs": {
    "description": "接口使用的权限点: `write_shipping` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "cfzLJZps",
  "parameters": [
    {
      "name": "carrier_service_id",
      "in": "path",
      "description": "承运商服务ID",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "carrier_service_id",
        "description": "承运商服务ID",
        "type": "string",
        "example": "123456"
      },
      "example": "123456"
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。请参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "carrier_service": {
              "name": "carrier_service",
              "description": "承运商服务信息",
              "type": "object",
              "properties": {
                "active": {
                  "name": "active",
                  "description": "承运商服务是否激活",
                  "type": "boolean",
                  "example": true
                },
                "service_name": {
                  "name": "service_name",
                  "description": "运输服务名称",
                  "type": "string",
                  "example": "Shipping Rate Provider"
                }
              },
              "example": {
                "service_name": "Shipping Rate Provider",
                "active": true
              }
            }
          },
          "example": {
            "carrier_service": {
              "active": true,
              "service_name": "Shipping Rate Provider"
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "carrier_service": {
                "name": "carrier_service",
                "description": "承运商服务信息",
                "type": "object",
                "properties": {
                  "callback_url": {
                    "name": "callback_url",
                    "description": "请求计算运费所需的 URL，必须是公网 URL。",
                    "type": "string",
                    "example": "http://shipping.example.com"
                  },
                  "carrier_service_type": {
                    "name": "carrier_service_type",
                    "description": "用于区别API运费和商家运费",
                    "type": "string",
                    "example": "api：应用参与配置运费; merchant：商家后台配置"
                  },
                  "id": {
                    "name": "id",
                    "description": "承运商服务的ID",
                    "type": "string",
                    "example": "\"123456\""
                  },
                  "name": {
                    "name": "name",
                    "description": "运输服务名称",
                    "type": "string",
                    "example": "Shipping Rate Provider"
                  },
                  "service_discovery": {
                    "name": "service_discovery",
                    "description": "商家是否能够通过 Shopline 后台承运商服务发送虚拟数据以查看运费示例",
                    "type": "boolean",
                    "example": true
                  },
                  "active": {
                    "name": "active",
                    "description": "承运商服务是否激活",
                    "type": "boolean",
                    "example": true
                  }
                },
                "example": {
                  "service_discovery": true,
                  "active": true,
                  "callback_url": "http://shipping.example.com",
                  "carrier_service_type": "api：应用参与配置运费; merchant：商家后台配置",
                  "id": "\"123456\"",
                  "name": "Shipping Rate Provider"
                }
              }
            },
            "example": {
              "carrier_service": {
                "name": "Shipping Rate Provider",
                "service_discovery": true,
                "active": true,
                "callback_url": "http://shipping.example.com",
                "carrier_service_type": "api：应用参与配置运费; merchant：商家后台配置",
                "id": "\"123456\""
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "put",
  "path": "/carrier_services/:carrier_service_id.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "更新承运商服务",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_shipping"
  ]
}
```