Share via


Attachments - Create Or Update

Creates or updates an attachment resource under a particular party.

PATCH {endpoint}/parties/{partyId}/attachments/{attachmentId}?api-version=2023-11-01-preview

URI Parameters

Name In Required Type Description
createdBy
formData

string

Created by user/tenant id.

createdDateTime
formData

string (date-time)

Date when resource was created.

description
formData

string

minLength: 0
maxLength: 500

Textual description of resource.

eTag
formData

string

The ETag value to implement optimistic concurrency.

file
formData

file (binary)

File to be uploaded.

id
formData

string

Unique id.

modifiedBy
formData

string

Modified by user/tenant id.

modifiedDateTime
formData

string (date-time)

Date when resource was last modified.

name
formData

string

minLength: 0
maxLength: 100

Name to identify resource.

originalFileName
formData

string

Original File Name for this attachment.

resourceId
formData

string

Associated Resource id for this attachment.

resourceType
formData

string

Associated Resource type for this attachment.

source
formData

string

minLength: 2
maxLength: 100

Source of the resource.

status
formData

string

minLength: 0
maxLength: 100

Status of the resource.

attachmentId
path True

string

Id of the attachment resource.

endpoint
path True

string (uri)

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

partyId
path True

string

Id of the associated party resource.

api-version
query True

string

The requested API version

Request Header

Media Types: "multipart/form-data"

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.

Responses

Name Type Description
200 OK

Attachment

Success

201 Created

Attachment

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

Attachments_CreateOrUpdate

Sample request

PATCH {endpoint}/parties/PARTY123/attachments/ATTACHMENT123?api-version=2023-11-01-preview

Sample response

{
  "id": "ATTACHMENT123",
  "partyId": "PARTY123",
  "resourceId": "PARTY123",
  "resourceType": "Party",
  "originalFileName": "attachment-file",
  "name": "John Smith's Field",
  "status": "Active",
  "description": "Some description",
  "source": "source",
  "createdDateTime": "2021-04-21T06:49:30Z",
  "modifiedDateTime": "2021-04-21T06:49:30Z",
  "createdBy": "00000000-0000-0000-0000-000000000000",
  "modifiedBy": "00000000-0000-0000-0000-000000000000",
  "eTag": "0f8fad5b-d9cb-469f-a165-70867728950e"
}
{
  "id": "ATTACHMENT123",
  "partyId": "PARTY123",
  "resourceId": "PARTY123",
  "resourceType": "Party",
  "originalFileName": "attachment-file",
  "name": "John Smith's Field",
  "status": "Active",
  "description": "Some description",
  "source": "source",
  "createdDateTime": "2021-04-21T06:49:30Z",
  "modifiedDateTime": "2021-04-21T06:49:30Z",
  "createdBy": "00000000-0000-0000-0000-000000000000",
  "modifiedBy": "00000000-0000-0000-0000-000000000000",
  "eTag": "0f8fad5b-d9cb-469f-a165-70867728950e"
}

Definitions

Name Description
Attachment

Schema of attachment resource.

AttachmentResourceType

Associated Resource type for this attachment.

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.

InnerError

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

Attachment

Schema of attachment resource.

Name Type Description
createdBy

string

Created by user/tenant id.

createdDateTime

string (date-time)

Date when resource was created.

description

string

minLength: 0
maxLength: 500

Textual description of resource.

eTag

string

The ETag value to implement optimistic concurrency.

id

string

Unique id.

modifiedBy

string

Modified by user/tenant id.

modifiedDateTime

string (date-time)

Date when resource was last modified.

name

string

minLength: 0
maxLength: 100

Name to identify resource.

originalFileName

string

Original File Name for this attachment.

partyId

string

PartyId id for this attachment.

resourceId

string

Associated Resource id for this attachment.

resourceType

AttachmentResourceType

Associated Resource type for this attachment.

source

string

minLength: 2
maxLength: 100

Source of the resource.

status

string

minLength: 0
maxLength: 100

Status of the resource.

AttachmentResourceType

Associated Resource type for this attachment.

Value Description
ApplicationData
Farm
Field
HarvestData
Party
PlantTissueAnalysis
PlantingData
Prescription
SeasonalField
TillageData

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.

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.