# 编辑库存

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/open/product/edit/stock:
    post:
      summary: 编辑库存
      deprecated: false
      description: |-
        特别提醒：
        如果商品为在架状态时，会同步更新库存信息到闲鱼App上。
        如果商品不是在架状态，只会更新闲管家内的库存信息。
      tags:
        - 商品
      parameters:
        - name: appid
          in: query
          description: ''
          required: true
          example: '{{appid}}'
          schema:
            type: string
        - name: timestamp
          in: query
          description: 当前时间戳（单位秒，5分钟内有效）
          required: false
          example: '{{timestamp}}'
          schema:
            type: integer
            default: '{{timestamp}}'
        - name: seller_id
          in: query
          description: 商家ID（仅商务对接传入，自研/第三方ERP对接忽略即可）
          example: '{{seller_id}}'
          schema:
            type: integer
        - name: sign
          in: query
          description: 签名MD5值（参考签名说明）
          required: true
          example: '{{sign}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                product_id:
                  type: integer
                  title: 管家商品ID
                  format: int64
                price:
                  type: integer
                  title: 商品售价（分）
                  description: 注意：多规格商品，必须是SKU其中一个金额
                  maximum: 9999999900
                  minimum: 1
                  examples:
                    - 199900
                original_price:
                  type: integer
                  title: 商品原价（分）
                  maximum: 9999999900
                  minimum: 0
                  examples:
                    - 299900
                stock:
                  type: integer
                  title: 单规格库存
                  description: 注意：单规格商品时必填
                  minimum: 0
                  maximum: 9999
                  examples:
                    - 10
                sku_items:
                  type: array
                  items:
                    type: object
                    properties:
                      sku_id:
                        type: integer
                        title: 管家SKU规格ID
                        format: int64
                        examples:
                          - 441870024105926
                      price:
                        title: SKU售价（分）
                        $ref: '#/components/schemas/price'
                      stock:
                        type: integer
                        title: SKU库存
                        maximum: 9999
                        format: int32
                        minimum: 0
                        examples:
                          - 10
                      outer_id:
                        type: string
                        title: SKU商品编码
                        examples:
                          - '2023072101'
                        minLength: 0
                        maxLength: 64
                    x-apifox-refs: {}
                    x-apifox-orders:
                      - sku_id
                      - price
                      - stock
                      - outer_id
                    required:
                      - sku_id
                      - stock
                    x-apifox-ignore-properties: []
                  description: 注意：多规格商品时必填，按需传入需要同步的sku库存即可
                  title: 多规格库存
              required:
                - product_id
              x-apifox-orders:
                - product_id
                - price
                - original_price
                - stock
                - sku_items
              x-apifox-ignore-properties: []
            example:
              product_id: 219530767978565
              stock: 99999
              sku_items:
                - stock: 6699
                  price: 99999
                  sku_id: 219530767978561
                - stock: 3982
                  price: 99999
                  sku_id: 219530767978562
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response_ok'
          headers: {}
          x-apifox-name: 成功
        x-200:失败:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    format: int32
                    examples:
                      - 500
                    additionalProperties: false
                  msg:
                    type: string
                    examples:
                      - Internal Server Error
                    additionalProperties: false
                required:
                  - code
                  - msg
                x-apifox-orders:
                  - code
                  - msg
                x-apifox-ignore-properties: []
          headers: {}
          x-apifox-name: 失败
      security: []
      x-apifox-folder: 商品
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/2973339/apis/api-93586384-run
components:
  schemas:
    price:
      type: integer
      title: 商品售价
      minimum: 1
      maximum: 9999999900
      format: int64
      examples:
        - 199900
      x-apifox-folder: ''
    response_ok:
      type: object
      properties:
        code:
          type: integer
          format: int32
          additionalProperties: false
          default: 0
        msg:
          type: string
          additionalProperties: false
          default: OK
        data:
          type: object
          properties: {}
          x-apifox-orders: []
          additionalProperties: false
          x-apifox-ignore-properties: []
      x-apifox-orders:
        - code
        - msg
        - data
      required:
        - code
        - msg
        - data
      title: 成功报文
      x-apifox-ignore-properties: []
      x-apifox-folder: ''
  securitySchemes:
    apiKey:
      type: apikey
      description: Enter JWT Bearer token **_only_**
      name: Authorization
      in: header
servers:
  - url: https://open.goofish.pro
    description: 新版正式环境
security: []

```
