Share via


Crops - List

Returns a paginated list of crop resources.

GET {endpoint}/crops?api-version=2023-11-01-preview
GET {endpoint}/crops?phenotypes={phenotypes}&breedingMethods={breedingMethods}&locations={locations}&referenceDatasetIds={referenceDatasetIds}&referenceRecordIds={referenceRecordIds}&ids={ids}&names={names}&propertyFilters={propertyFilters}&statuses={statuses}&minCreatedDateTime={minCreatedDateTime}&maxCreatedDateTime={maxCreatedDateTime}&minLastModifiedDateTime={minLastModifiedDateTime}&maxLastModifiedDateTime={maxLastModifiedDateTime}&maxPageSize={maxPageSize}&skipToken={skipToken}&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

api-version
query True

string

The requested API version

breedingMethods
query

string[]

Breeding method of the crop.

ids
query

string[]

Ids of the resource.

locations
query

string[]

Location of the crop.

maxCreatedDateTime
query

string (date-time)

Maximum creation date of resource (inclusive).

maxLastModifiedDateTime
query

string (date-time)

Maximum last modified date of resource (inclusive).

maxPageSize
query

integer (int32)

minimum: 10
maximum: 1000

Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50.

minCreatedDateTime
query

string (date-time)

Minimum creation date of resource (inclusive).

minLastModifiedDateTime
query

string (date-time)

Minimum last modified date of resource (inclusive).

names
query

string[]

Names of the resource.

phenotypes
query

string[]

Crop phenotypes of the crop.

propertyFilters
query

string[]

Filters on key-value pairs within the Properties object. eg. "{testKey} eq {testValue}".

referenceDatasetIds
query

string[]

Reference dataset id of the crop.

referenceRecordIds
query

string[]

Reference record id of the crop.

skipToken
query

string

Skip token for getting next set of results.

statuses
query

string[]

Statuses of the resource.

Request Header

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

CropListResponse

Success

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

Crops_List

Sample request

GET {endpoint}/crops?api-version=2023-11-01-preview

Sample response

{
  "value": [
    {
      "id": "CORN123",
      "phenotype": "Corn",
      "breedingMethod": "VARIETY",
      "measurements": {
        "m1": {
          "unit": "string",
          "value": 0
        },
        "m2": {
          "unit": "string",
          "value": 0
        },
        "m3": {
          "unit": "string",
          "value": 0
        }
      },
      "name": "John Smith's Crop",
      "status": "Active",
      "description": "Some description",
      "source": "source",
      "properties": {
        "Irrigated": "Yes",
        "RetailerId": "Retailer123"
      },
      "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"
    }
  ],
  "skipToken": "string",
  "nextLink": "https://{{resourceName}}.farmbeats.azure.net/parties/{{partyId}}/seasonalFields/{{seasonalFieldId}}?api-version={{apiVersion}}&skipToken=%5b%7b%22token%22%3a%22%2bRID%3a%7e23TRC%3a10%23ISA%3d%22%2c%22range%22%3a%7b%22min%22%3a%22%22%2c%22max%22%3a%22FF%22%7d%7d%5d"
}

Definitions

Name Description
Crop

Schema of crop resource.

CropListResponse

Paged response contains list of requested objects and a URL link to get the next set of results.

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.

Measure

Schema for storing measurement reading and unit.

Reference

Reference to a dataset record.

Crop

Schema of crop resource.

Name Type Description
breedingMethod

string

Type of breeding Method like VARIETY, HYBRID, UNKNOWN.

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

Unique resource ID.

location

string

minLength: 0
maxLength: 50

Region where the crop is planted.

measurements

<string,  Measure>

The properties that pertain to this crop such as nominal weight, nominal moisture, and shrink factor.

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.

phenotype

string

minLength: 0
maxLength: 100

Phenotype of the crop. Example values are crop weight, height, color, etc.

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.

reference

Reference

Reference to a dataset record.

source

string

minLength: 2
maxLength: 100

Source of the resource.

status

string

minLength: 0
maxLength: 100

Status of the resource.

CropListResponse

Paged response contains list of requested objects and a URL link to get the next set of results.

Name Type Description
nextLink

string

Continuation link (absolute URI) to the next page of results in the list.

skipToken

string

Token used in retrieving the next page. If null, there are no additional pages.

value

Crop[]

List of requested objects.

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.

Measure

Schema for storing measurement reading and unit.

Name Type Description
unit

string

minLength: 1
maxLength: 50

Data unit.

value

number (double)

Data value.

Reference

Reference to a dataset record.

Name Type Description
datasetId

string

minLength: 0
maxLength: 100

Dataset id.

recordId

string

minLength: 0
maxLength: 100

Record id.