Tasks

List Tasks

Tasks and records. For one mob's completed history — the duplicate check before createTreatmentRecord — pass asset_id set to the mob id and filter[status][]=completed, then compare treatment.products and completed_at. A treatment on the same date with the same product is probably a duplicate. Tags are not required for that check. filter[status][] is sent as filter_status by the MCP tool.

PurpleGrain AI records that name no mob or paddock (the Unassigned group of a property's Tasks & records board): send filter[farm_id]=<farm id>&filter[unassigned]=true&filter[operation_type][]=ai. The MCP tool sends these as filter_farm_id, filter_unassigned and filter_operation_type. A formatted record that was left unassigned (the words fit more than one mob) is the same query without the ai filter, or with its real type, and carries the candidates in ai_format_meta.

get/tasks

Request

  • Base URL: https://api.purplegrain.com/api/v1
  • URL: https://api.purplegrain.com/api/v1/tasks
  • Auth: none declared

Query parameters

pageinteger

Select within paginated results

per_pageinteger

Number results to return

producer_idstring

Producer id to filter on

producer_typestring

Producer type to filter on

provider_idstring

Provider (assigned contractor) id to filter on

provider_typestring

Provider type to filter on

asset_typestring

The kind of farm asset asset_id names — paddock or mob, singular or plural. Honoured when it names one of those two and ignored otherwise, since asset_id is a uuid and identifies the row on its own. Deliberately no enum, exactly like producer_type and provider_type on this operation: a schema stricter than the filter rejects valid traffic the day request validation is enforced.

asset_idstring

The property board: every task and record on one paddock or one mob, in board order. This is an ENTRY scope — it needs no producer or provider alongside it, and it is what a paddock or mob screen calls. Combine with filter[status][] to split the board's To do from its Done, and with include=asset to embed the paddock or mob itself.

has_assetboolean

Narrow an owner listing to the rows that are (or are not) about a farm asset. has_asset=true alongside producer_id / producer_type is the org-wide property board in one page — producer_id=<org id>&producer_type=organizations&has_asset=true&include=asset — instead of one request per paddock and per mob per farm. has_asset=false is the inverse: the work that is about no block of ground.

roadmapboolean

Return the public roadmap's items instead of a producer/provider listing: the tasks posted by the roadmap account, oldest first. Which account that is comes from server configuration, so the client does not name it. These tasks are deliberately excluded from GET /tasks/search.

filter[id][]string[]

Filter returned results on ids

filter[status][]string[]

Filter returned results on status. Narrows whichever entry scope was chosen — the producer/provider listing, filter[id][], the roadmap or a paddock/mob board — so asset_id=…&filter[status][]=pending is a board's To do and asset_id=<mob id>&filter[status][]=completed is that mob's records (check these for a same-date, same-product drench before creating one). A value outside the enum returns no rows rather than the unfiltered set. The MCP tool sends this parameter as filter_status.

filter[parent_id][]string[]

Only the sub-tasks of these parent tasks. Narrows a producer/provider listing, or stands on its own — a parent's children are as public as the parent. The literal null selects top-level tasks (no parent), so producer_id=…&filter[parent_id][]=null&include=children fetches a whole board in one request: the top-level tasks with their sub-tasks embedded. null on its own, without an owner, returns nothing.

filter[farm_id]string

Everything filed on one property, as an ENTRY scope like asset_id (it needs no producer alongside it), or a narrowing of one. Unlike the owner scopes it is authorized: the caller must be able to read the property (a member, anyone for a public property, or the holder of its share token), otherwise 403. Combine with filter[unassigned] and filter[operation_type][] for the Unassigned group.

filter[unassigned]boolean

true narrows the listing to the rows that name no mob or paddock (asset_id is null): the same rows as has_asset=false, named for the Unassigned group it feeds. filter[farm_id]=…&filter[unassigned]=true& filter[operation_type][]=ai is a property's PurpleGrain AI records still waiting for the formatter to place them.

filter[operation_type][]string[]

Only rows whose operation_type is one of these (ai for a PurpleGrain AI record waiting for the formatter, or a real type such as treatment). Narrows whichever entry scope was chosen. A value no task has returns no rows. The MCP tool sends this parameter as filter_operation_type.

includestring
Example:producer,provider,service

Comma-separated snake_case relationship paths to embed (JSON:API included array, or inlined for application/json). Never embedded by default; unknown paths ignored; dot notation selects children; max 10 paths. Allowed paths: producer, provider, category, place, place.location, service, service.owner, service.category, service.city, service.place, service.location, farm, parent, children, asset.

Response

The listing in board order — position ascending with unplaced rows (null position) after the placed ones, then creation time — except roadmap=true, which stays oldest-first. When the include query parameter is used, the response may contain an included array (JSON:API) or inlined related resources (application/json).

Example response

{
  "data": [
    {
      "type": "task"
    }
  ]
}

Changes

No recorded changes to this operation across all 2 revisions of this API.