你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Datasets - Create Or Update

创建或更新数据集。

PATCH {endpoint}/datasets/{datasetId}?api-version=2023-11-01-preview

URI 参数

名称 必需 类型 说明
datasetId
path True

string

数据集资源的 ID。

endpoint
path True

string

uri

命名空间的主机名,例如 admaInstanceName.farmbeats.azure.net

api-version
query True

string

请求的 API 版本

请求头

Media Types: "application/merge-patch+json"

名称 必需 类型 说明
Authorization True

string

请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。

请求正文

Media Types: "application/merge-patch+json"

名称 类型 说明
description

string

资源的文本说明。

name

string

用于标识资源的名称。

properties

属于资源的键值对的集合。 每对的键不能超过 50 个字符,并且值不能大于 150 个字符。 注意:最多可以为资源提供 25 个键值对,并且仅支持字符串、数字和 datetime (yyyy-MM-ddTHH:mm:ssZ) 值。

recordsSchema

数据集下记录的架构。

source

string

资源的源。

status

string

资源的状态。

type

DatasetType

数据集的类型。 支持的类型:Crop、CropProduct、ChemicalProduct、Equipment。

响应

名称 类型 说明
200 OK

Dataset

成功

201 Created

Dataset

创建

Other Status Codes

ErrorResponse

错误

Headers

x-ms-error-code: string

安全性

Authorization

请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。

Type: apiKey
In: header

示例

Datasets_CreateOrUpdate

Sample Request

PATCH {endpoint}/datasets/Dataset1?api-version=2023-11-01-preview

{
  "type": "Chemical",
  "recordsSchema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "minLength": 2,
        "maxLength": 100
      },
      "code": {
        "type": "string"
      },
      "Company": {
        "type": "string"
      },
      "MatterStateCode": {
        "type": "string"
      },
      "RegulatorNumbers": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstancePercentages": {
        "type": "number",
        "maximum": 100,
        "minimum": 0
      },
      "CreatedAtDate": {
        "type": "string",
        "format": "date-time"
      },
      "UpdatedAtDate": {
        "type": "string",
        "format": "date-time"
      }
    },
    "required": [
      "Company",
      "name"
    ],
    "additionalProperties": false
  },
  "status": "string",
  "source": "Partner",
  "name": "Chemical Dataset",
  "description": "Chemical Dataset",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

Sample Response

{
  "type": "Chemical",
  "recordsSchema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "minLength": 2,
        "maxLength": 100
      },
      "code": {
        "type": "string"
      },
      "Company": {
        "type": "string"
      },
      "MatterStateCode": {
        "type": "string"
      },
      "RegulatorNumbers": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstancePercentages": {
        "type": "number",
        "maximum": 100,
        "minimum": 0
      },
      "CreatedAtDate": {
        "type": "string",
        "format": "date-time"
      },
      "UpdatedAtDate": {
        "type": "string",
        "format": "date-time"
      }
    },
    "required": [
      "Company",
      "name"
    ],
    "additionalProperties": false
  },
  "id": "Dataset1",
  "status": "string",
  "createdDateTime": "2023-10-17T17:52:44Z",
  "modifiedDateTime": "2023-10-17T17:52:44Z",
  "source": "Partner",
  "name": "Chemical Dataset",
  "description": "Chemical Dataset",
  "createdBy": "00000000-0000-0000-0000-000000000000",
  "modifiedBy": "00000000-0000-0000-0000-000000000000",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}
{
  "type": "Chemical",
  "recordsSchema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "minLength": 2,
        "maxLength": 100
      },
      "code": {
        "type": "string"
      },
      "Company": {
        "type": "string"
      },
      "MatterStateCode": {
        "type": "string"
      },
      "RegulatorNumbers": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ChemicalTypeNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceCodes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstanceNames": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "SubstancePercentages": {
        "type": "number",
        "maximum": 100,
        "minimum": 0
      },
      "CreatedAtDate": {
        "type": "string",
        "format": "date-time"
      },
      "UpdatedAtDate": {
        "type": "string",
        "format": "date-time"
      }
    },
    "required": [
      "Company",
      "name"
    ],
    "additionalProperties": false
  },
  "id": "Dataset1",
  "eTag": "43009725-0000-0700-0000-652ec9ec0000",
  "status": "string",
  "createdDateTime": "2023-10-17T17:52:44Z",
  "modifiedDateTime": "2023-10-17T17:52:44Z",
  "source": "Partner",
  "name": "Chemical Dataset",
  "description": "Chemical Dataset",
  "createdBy": "00000000-0000-0000-0000-000000000000",
  "modifiedBy": "00000000-0000-0000-0000-000000000000",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

定义

名称 说明
Dataset

数据集资源的架构。

DatasetType

数据集的类型。 支持的类型:Crop、CropProduct、ChemicalProduct、Equipment。

Error

Azure AgPlatform 服务出错。

ErrorResponse

来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。

InnerError

包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object

Dataset

数据集资源的架构。

名称 类型 说明
createdBy

string

由用户/租户 ID 创建。

createdDateTime

string

创建资源的日期时间,示例格式:yyyy-MM-ddTHH:mm:ssZ。

description

string

资源的文本说明。

eTag

string

实现乐观并发的 ETag 值。

id

string

唯一资源 ID。

modifiedBy

string

由用户/租户 ID 修改。

modifiedDateTime

string

上次修改资源的日期时间,示例格式:yyyy-MM-ddTHH:mm:ssZ。

name

string

用于标识资源的名称。

properties

属于资源的键值对的集合。 每对的键不能超过 50 个字符,并且值不能大于 150 个字符。 注意:最多可以为资源提供 25 个键值对,并且仅支持字符串、数字和 datetime (yyyy-MM-ddTHH:mm:ssZ) 值。

recordsSchema

数据集下记录的架构。

solutionId

string

数据集解决方案的解决方案 ID。

source

string

资源的源。

status

string

资源的状态。

type

DatasetType

数据集的类型。 支持的类型:Crop、CropProduct、ChemicalProduct、Equipment。

DatasetType

数据集的类型。 支持的类型:Crop、CropProduct、ChemicalProduct、Equipment。

名称 类型 说明
ChemicalProduct

string

Crop

string

CropProduct

string

FarmEquipment

string

Error

Azure AgPlatform 服务出错。

名称 类型 说明
code

string

服务器定义的错误代码集。

details

Error[]

有关导致此报告错误的特定错误的详细信息数组。

innererror

InnerError

包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object

message

string

错误的用户可读表示形式。

target

string

错误的目标。

ErrorResponse

来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。

名称 类型 说明
error

Error

Azure AgPlatform 服务出错。

traceId

string

唯一跟踪 ID。

InnerError

包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object

名称 类型 说明
code

string

包含的错误提供的特定错误代码。

innererror

InnerError

包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object