Share via


Insights - Create Or Update

Creates or updates insight entity.

PATCH {endpoint}/parties/{partyId}/models/{modelId}/resource-types/{resourceType}/resources/{resourceId}/insights/{insightId}?api-version=2023-11-01-preview

URI Parameters

Name In Required Type Description
endpoint
path True

string (uri)

The host name of the namespace, e.g. admaInstanceName.farmbeats.azure.net

insightId
path True

string

Id of the insight resource.

modelId
path True

string

Id of the associated model.

partyId
path True

string

Id of the associated party.

resourceId
path True

string

Id of the associated resource.

resourceType
path True

string

Resource type associated with the record.

api-version
query True

string

The requested API version

Request Header

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

Name Required Type Description
Authorization True

string

Please provide a valid bearer token for authorized API calls. Note that you might need to clear your browser cache if you tried un-authenticated calls before.

Request Body

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

Name Type Description
description

string

minLength: 0
maxLength: 500

Textual description of the resource.

insightEndDateTime

string (date-time)

End date to which the insight is related.

insightStartDateTime

string (date-time)

Start date to which the insight is related.

measurements

<string,  Measure>

Measures to capture insights results.

modelVersion

string

Version of the associated model.

name

string

minLength: 0
maxLength: 100

Name to identify resource.

properties

A collection of key value pairs that belongs to the resource. Each pair must not have a key greater than 50 characters and must not have a value greater than 150 characters. Note: A maximum of 25 key value pairs can be provided for a resource and only string, numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.

status

string

minLength: 0
maxLength: 100

Status of the resource.

Responses

Name Type Description
200 OK

Insight

Success

201 Created

Insight

Created

Other Status Codes

ErrorResponse

Error

Headers

x-ms-error-code: string

Security

Authorization

Please provide a valid bearer token for authorized API calls. Note that you might need to clear your browser cache if you tried un-authenticated calls before.

Type: apiKey
In: header

Examples

Insights_CreateOrUpdate

Sample request

PATCH {endpoint}/parties/pjparty/models/BiomassModelId/resource-types/Farm/resources/farmId/insights/insightId?api-version=2023-11-01-preview

{
  "modelVersion": "1.0",
  "insightStartDateTime": "2021-07-26T09:31:54.043Z",
  "insightEndDateTime": "2021-07-26T09:31:54.043Z",
  "measurements": {
    "additionalPropKey1": {
      "unit": "15m/s",
      "value": 0
    }
  },
  "name": "insightName",
  "description": "insightDescription",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

Sample response

{
  "id": "insightId",
  "partyId": "pjparty",
  "resourceId": "farmId",
  "resourceType": "Farm",
  "modelId": "modelId",
  "modelVersion": "1.0",
  "insightStartDateTime": "2021-07-26T09:31:54Z",
  "insightEndDateTime": "2021-07-26T09:31:54Z",
  "measurements": {
    "additionalPropKey1": {
      "unit": "15m/s",
      "value": 0
    }
  },
  "attachmentsLink": "https://contosa.farmbeats.azure.net/party/pjparty/insight-attachments/insightId?api-version=2023-11-01-preview&modelId=modelId&resourceType=Farm&resourceId=farmId",
  "createdDateTime": "2021-07-26T11:19:11Z",
  "modifiedDateTime": "2021-07-26T11:19:11Z",
  "eTag": "00000000-0000-0000-8210-0ef9229601d7",
  "name": "insightName",
  "description": "insightDescription",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}
{
  "id": "insightId",
  "partyId": "pjparty",
  "resourceId": "farmId",
  "resourceType": "Farm",
  "modelId": "modelId",
  "modelVersion": "1.0",
  "attachmentsLink": "https://contosa.farmbeats.azure.net/party/pjparty/insight-attachments/insightId?api-version=2023-11-01-preview&modelId=modelId&resourceType=Farm&resourceId=farmId",
  "insightStartDateTime": "2021-07-26T09:31:54Z",
  "insightEndDateTime": "2021-07-26T09:31:54Z",
  "measurements": {
    "additionalPropKey1": {
      "unit": "15m/s",
      "value": 0
    }
  },
  "createdDateTime": "2021-07-26T11:19:11Z",
  "modifiedDateTime": "2021-07-26T11:19:11Z",
  "eTag": "00000000-0000-0000-8210-0ef9229601d7",
  "name": "insightName",
  "description": "insightDescription",
  "properties": {
    "key1": "value1",
    "key2": 123.45
  }
}

Definitions

Name Description
Error

An error from the Azure AgPlatform service.

ErrorResponse

An error response from the Azure AgPlatform service. See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses for ErrorResponse reference document.

FarmHierarchyResourceType

Resource type associated with the record.

InnerError

Inner error containing list of errors.See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object for InnerError reference document.

Insight

Schema of insight resource.

Measure

Schema for storing measurement reading and unit.

Error

An error from the Azure AgPlatform service.

Name Type Description
code

string

minLength: 1

Server-defined set of error codes.

details

Error[]

Array of details about specific errors that led to this reported error.

innererror

InnerError

Inner error containing list of errors.See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object for InnerError reference document.

message

string

minLength: 1

Human-readable representation of the error.

target

string

Target of the error.

ErrorResponse

An error response from the Azure AgPlatform service. See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses for ErrorResponse reference document.

Name Type Description
error

Error

An error from the Azure AgPlatform service.

traceId

string

Unique trace Id.

FarmHierarchyResourceType

Resource type associated with the record.

Value Description
Party
Farm
Field
SeasonalField

InnerError

Inner error containing list of errors.See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object for InnerError reference document.

Name Type Description
code

string

Specific error code than was provided by the containing error.

innererror

InnerError

Inner error containing list of errors.See https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object for InnerError reference document.

Insight

Schema of insight resource.

Name Type Description
attachmentsLink

string

Gets link for attachments.

createdBy

string

Created by user/tenant id.

createdDateTime

string (date-time)

Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.

description

string

minLength: 0
maxLength: 500

Textual description of the resource.

eTag

string

The ETag value to implement optimistic concurrency.

id

string

Id of the resource.

insightEndDateTime

string (date-time)

End date to which the insight is related.

insightStartDateTime

string (date-time)

Start date to which the insight is related.

measurements

<string,  Measure>

Measures to capture insights results.

modelId

string

Id of the associated model.

modelVersion

string

Version of the associated model.

modifiedBy

string

Modified by user/tenant id.

modifiedDateTime

string (date-time)

Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.

name

string

minLength: 0
maxLength: 100

Name to identify resource.

partyId

string

Id of the associated party.

properties

A collection of key value pairs that belongs to the resource. Each pair must not have a key greater than 50 characters and must not have a value greater than 150 characters. Note: A maximum of 25 key value pairs can be provided for a resource and only string, numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.

resourceId

string

Id of the associated resource.

resourceType

FarmHierarchyResourceType

Resource type associated with the record.

status

string

minLength: 0
maxLength: 100

Status of the resource.

Measure

Schema for storing measurement reading and unit.

Name Type Description
unit

string

minLength: 1
maxLength: 50

Data unit.

value

number (double)

Data value.