api-docs icon indicating copy to clipboard operation
api-docs copied to clipboard

Metadata API: Access the sheet to which a field/column is linked

Open mlrawlings opened this issue 7 years ago • 1 comments

I would expect a field object to also contain a linkedSheet property (or something similar) which is the id of sheet this field is linked to, if fieldType=link.

I've updated the docs to illustrate what I want:

Getting field info

GET https://api.fieldbook.com/v1/sheets/:sheet_id/fields

Lists fields in a sheet. The response is an array of objects, each with:

  • key: permanent field id, unique only within a sheet
  • name: display name for the field
  • slug: field slug used in reading/writing records via the main API
  • fieldType: data, link or formula
  • inputType: data input type, if fieldType=data
  • linkedSheet: id of the sheet this field is linked to, if fieldType=link
  • required: boolean, may be omitted if false
  • enum: for pick list fields, this is the choice list in order

...

Example:

$ curl -u $KEY:$SECRET https://api.fieldbook.com/v1/sheets/58e1a67f5662a603001916ed/fields

Response (HTTP 200 OK):

[
  {
    "key": "f0",
    "name": "Name",
    "required": true,
    "slug": "name",
    "fieldType": "data",
    "inputType": "generic"
  },
  {
    "key": "f1",
    "name": "Description",
    "slug": "description",
    "fieldType": "data",
    "inputType": "text"
  },
  {
    "key": "f2",
    "name": "Price",
    "slug": "price",
    "fieldType": "data",
    "inputType": "currency"
  },
  {
    "key": "f3",
    "name": "Status",
    "slug": "status",
    "fieldType": "data",
    "inputType": "picklist",
    "enum": [
      "Available",
      "Out of stock",
      "Discontinued"
    ]
  },
  {
    "key": "f4",
    "name": "Line items",
    "slug": "line_items",
    "fieldType": "link",
    "linkedSheet":"58e1ac185662a6030019170e"
  }
]

mlrawlings avatar Apr 12 '17 18:04 mlrawlings