# 通过JSON文件导入商品

通过指定的URL从JSON文件将商品导入商店。关于从JSON文件导入的更多信息，请参阅文档。

Endpoint: POST /v1/projects/{project_id}/import/from_external_file
Version: 2.0.0
Security: basicAuth

## Path parameters:

  - `project_id` (integer, required)
    项目ID。您可以在发布商帐户的项目名称旁找到此参数；使用项目时，也可以在浏览器地址栏中找到此参数。URL格式如下：https://publisher.xsolla.com//projects/。
    Example: 44056

## Request fields (application/json):

  - `connector_external_id` (string, required)
    指定商品导入操作类型的固定值。
    Enum: "import_items"

  - `file_url` (string, required)
    JSON格式数据文件的URL。该文件应托管在可公开访问的存储服务上。您可以在发布商帐户的[商店 > 虚拟物品 > 商品管理 > 导入商品(JSON)](https://publisher.xsolla.com/0/projects/0/storefront/import-export/import-items)中下载文件模板。
    Example: "https://my-bucket.s3.amazonaws.com/items.json"

  - `mode` (string)
    导入操作：

可能值：
- create — 添加新商品。
- create_and_update — 添加新商品并更新现有商品。
- sync — 添加新商品、更新现有商品并禁用缺失商品。
    Enum: "create", "create_and_update", "sync"

## Response 201 fields (application/json):

  - `import_id` (string)
    Import operation ID. If you encounter difficulties importing the JSON file, report this ID to your Customer Success Manager or send an email to csm@xsolla.com.
    Example: "af9f3638a16e11ef880da2cd677d2d24"

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1020

  - `errorMessage` (string)
    Example: "[0401-1020]: Error in Authentication method occurred"

## Response 422 fields (application/json):

  - `errorCode` (integer)
    Example: 1803

  - `statusCode` (integer)
    Example: 422

  - `errorMessage` (string)
    Example: "[0410-1803]: File content-type doesn't allowed. Allowed content types: application/json; current content type: text/plain"

  - `transactionId` (string)
    Example: "x-x-x-x-transactionId-mock-x-x-x"


