Skip to main content

Samplings

This API is to obtain samplings data created in the samplings feature.

Endpoints

sampling

GET /api/sampling

Returns an array with the samples according to the filters indicated in the query string.

One of the following parameters must be sent it in the query string:

  • field_id: ìnteger, field id
  • sampling_uuid: string, sampling uuid (if known)

Response

The following is the interface of an example response:

interface ApiSamplingI {
code: int
data: DataI[]
}

interface DataI {
groups: GroupI[]
yeargroup: number
created_at: string
field_id: number
zoning: {
info: {
map_id: string
}
type: string
}
analysis: {
[key: string]: AnalysisType[]
}
field_uuid: string
sampling_name: string
points: Point[]
group_assigned_id: number
sampling_uuid: string
closed_at: string | null
sample_set_uuid: string
}

interface GroupI {
samples: SampleI[]
group_data: {
sampling: {
color: string
name: string
}
}
group_uuid: string
}

interface SampleI {
code: string
spot_data: {
variables: VariableI[]
sampling: {
analysis: string
}
}
spot_uuid: string
}

interface VariableI {
name: string
value?: number
unit_id: number
}

interface AnalysisType {
name: string
unit_id: number
}

interface Point {
geometry: string
point_uuid: string
checked: number
created_at: string
group_uuid: string
}

analysis

GET /api/sampling/analysis

Returns an array with the analyzes and other sample data according to the filters indicated in the query string.

One of the following parameters must be sent in the query string:

  • field_id: ìnteger, field id
  • farm_id: ìnteger, farm id
  • sampling_uuid: string, sampling uuid (if known)

Response

The following is the interface of an example response:


interface SamplingAnalysisI {
code: number
data: DataI[]
}

interface DataI {
farm_id: number
field_id: number
zoning: ZoningI
analysis: AnalysisI
sampling_name: string
sampling_uuid: string
sample_set_uuid: string
}

interface ZoningI {
info: {
date: string // optional
layer: string // optional
operation: string // optional
hour: string // optional
provider: string // optional
map_id: string // optional
}
type: string
}

interface AnalysisI {
[key: string]: {
name: string
unit_id: number
}[]
}

Variables list

GET /api/sampling/variablelist

Returns a list of variables of the samples.

It is not necessary to send any parameters in the query string.

Response

The following is the response interface:

interface VariableListResponseI {
code: number
variablelist: Variablelist[]
}

interface Variablelist {
items: Item[]
list_name: string
variablelist_uuid: string
}

interface Item {
name: string
value: number
}

Errors

These errors are specific to the samplings API, in addition to the general API errors.

codemsg
-11insufficient permissions