다음을 통해 공유


Devices - Create Or Update

디바이스 엔터티를 만듭니다.

PATCH {endpoint}/sensor-partners/{sensorPartnerId}/devices/{deviceId}?api-version=2023-11-01-preview

URI 매개 변수

Name In(다음 안에) 필수 형식 Description
deviceId
path True

string

디바이스 리소스의 ID입니다.

endpoint
path True

string (uri)

네임스페이스의 호스트 이름(예: admaInstanceName.farmbeats.azure.net

sensorPartnerId
path True

string

센서 파트너의 ID입니다.

api-version
query True

string

요청된 API 버전

요청 헤더

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

Name 필수 형식 Description
Authorization True

string

권한 있는 API 호출에 유효한 전달자 토큰을 제공하세요. 이전에 인증되지 않은 호출을 시도한 경우 브라우저 캐시를 지워야 할 수 있습니다.

요청 본문

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

Name 형식 Description
description

string

minLength: 0
maxLength: 500

리소스에 대한 텍스트 설명입니다.

deviceDataModelId

string

연결된 디바이스 데이터 모델의 ID입니다.

hardwareId

string

minLength: 0
maxLength: 100

디바이스 hardwareId.

integrationId

string

디바이스의 통합 ID입니다.

location

Location

위치 모델 클래스입니다.

name

string

minLength: 0
maxLength: 100

리소스를 식별하는 이름입니다.

parentDeviceId

string

이 디바이스의 부모 디바이스 ID입니다.

properties

리소스에 속하는 키 값 쌍의 컬렉션입니다. 각 쌍에는 50자보다 큰 키가 없어야 하며 150자보다 큰 값은 없어야 합니다. 참고: 리소스에 대해 최대 25개의 키 값 쌍을 제공할 수 있으며 문자열, 숫자 및 datetime(yyyy-MM-ddTHH:mm:ssZ) 값만 지원됩니다.

reportingIntervalInSeconds

integer (int32)

디바이스가 데이터를 초 단위로 보내는 간격입니다.

status

string

minLength: 0
maxLength: 100

리소스의 상태입니다.

type

string

minLength: 0
maxLength: 100

디바이스의 유형입니다.

응답

Name 형식 Description
200 OK

Device

성공

201 Created

Device

생성됨

Other Status Codes

ErrorResponse

오류

헤더

x-ms-error-code: string

보안

Authorization

권한 있는 API 호출에 유효한 전달자 토큰을 제공하세요. 이전에 인증되지 않은 호출을 시도한 경우 브라우저 캐시를 지워야 할 수 있습니다.

형식: apiKey
In(다음 안에): header

예제

Devices_CreateOrUpdate

샘플 요청

PATCH {endpoint}/sensor-partners/sp1/devices/d124?api-version=2023-11-01-preview

{
  "deviceDataModelId": "ddm124",
  "integrationId": "string",
  "type": "device",
  "hardwareId": "HD156",
  "reportingIntervalInSeconds": 10,
  "location": {
    "latitude": 23.5,
    "longitude": 42.7
  },
  "status": "new device",
  "name": "my device",
  "description": "description goes here",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

샘플 응답

{
  "deviceDataModelId": "ddm124",
  "integrationId": "string",
  "type": "device",
  "hardwareId": "HD156",
  "reportingIntervalInSeconds": 10,
  "location": {
    "latitude": 23.5,
    "longitude": 42.7
  },
  "sensorPartnerId": "sp1",
  "id": "d123",
  "status": "new device",
  "createdDateTime": "2022-01-24T06:20:47Z",
  "modifiedDateTime": "2022-01-24T06:21:07Z",
  "eTag": "0401a5cc-0000-0700-0000-61ee45540000",
  "name": "my device",
  "description": "description goes here",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}
{
  "deviceDataModelId": "ddm124",
  "integrationId": "string",
  "type": "device",
  "hardwareId": "HD156",
  "reportingIntervalInSeconds": 10,
  "location": {
    "latitude": 23.5,
    "longitude": 42.7
  },
  "sensorPartnerId": "sp1",
  "id": "d123",
  "status": "new device",
  "createdDateTime": "2022-01-24T06:20:47Z",
  "modifiedDateTime": "2022-01-24T06:20:47Z",
  "eTag": "0401baca-0000-0700-0000-61ee453f0000",
  "name": "my device",
  "description": "description goes here",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

정의

Name Description
Device

디바이스 API 모델.

Error

Azure AgPlatform 서비스의 오류입니다.

ErrorResponse

Azure AgPlatform 서비스의 오류 응답입니다. ErrorResponse 참조 문서는 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses 참조하세요.

InnerError

오류 목록을 포함하는 내부 오류입니다. InnerError 참조 문서에 대한 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 참조하세요.

Location

위치 모델 클래스입니다.

Device

디바이스 API 모델.

Name 형식 Description
createdBy

string

사용자/테넌트 ID로 생성됩니다.

createdDateTime

string (date-time)

리소스를 만든 날짜-시간 샘플 형식: yyyy-MM-ddTHH:mm:ssZ.

description

string

minLength: 0
maxLength: 500

리소스에 대한 텍스트 설명입니다.

deviceDataModelId

string

연결된 디바이스 데이터 모델의 ID입니다.

eTag

string

낙관적 동시성을 구현하는 ETag 값입니다.

hardwareId

string

minLength: 0
maxLength: 100

디바이스 hardwareId.

id

string

리소스의 ID입니다.

integrationId

string

디바이스의 통합 ID입니다.

location

Location

위치 모델 클래스입니다.

modifiedBy

string

사용자/테넌트 ID로 수정되었습니다.

modifiedDateTime

string (date-time)

리소스가 마지막으로 수정된 날짜-시간, 샘플 형식: yyyy-MM-ddTHH:mm:ssZ.

name

string

minLength: 0
maxLength: 100

리소스를 식별하는 이름입니다.

parentDeviceId

string

이 디바이스의 부모 디바이스 ID입니다.

properties

리소스에 속하는 키 값 쌍의 컬렉션입니다. 각 쌍에는 50자보다 큰 키가 없어야 하며 150자보다 큰 값은 없어야 합니다. 참고: 리소스에 대해 최대 25개의 키 값 쌍을 제공할 수 있으며 문자열, 숫자 및 datetime(yyyy-MM-ddTHH:mm:ssZ) 값만 지원됩니다.

reportingIntervalInSeconds

integer (int32)

디바이스가 데이터를 초 단위로 보내는 간격입니다.

sensorPartnerId

string

연결된 센서 파트너의 ID입니다.

status

string

minLength: 0
maxLength: 100

리소스의 상태입니다.

type

string

minLength: 0
maxLength: 100

디바이스의 유형입니다.

Error

Azure AgPlatform 서비스의 오류입니다.

Name 형식 Description
code

string

minLength: 1

서버에서 정의한 오류 코드 집합입니다.

details

Error[]

이 보고된 오류로 이어진 특정 오류에 대한 세부 정보 배열입니다.

innererror

InnerError

오류 목록을 포함하는 내부 오류입니다. InnerError 참조 문서에 대한 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 참조하세요.

message

string

minLength: 1

사람이 읽을 수 있는 오류 표현입니다.

target

string

오류의 대상입니다.

ErrorResponse

Azure AgPlatform 서비스의 오류 응답입니다. ErrorResponse 참조 문서는 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses 참조하세요.

Name 형식 Description
error

Error

Azure AgPlatform 서비스의 오류입니다.

traceId

string

고유 추적 ID입니다.

InnerError

오류 목록을 포함하는 내부 오류입니다. InnerError 참조 문서에 대한 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 참조하세요.

Name 형식 Description
code

string

포함된 오류에서 제공한 것보다 구체적인 오류 코드입니다.

innererror

InnerError

오류 목록을 포함하는 내부 오류입니다. InnerError 참조 문서에 대한 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 참조하세요.

Location

위치 모델 클래스입니다.

Name 형식 Description
latitude

number (double)

minimum: -90
maximum: 90

위치의 위도입니다.

longitude

number (double)

minimum: -180
maximum: 180

위치의 경도입니다.