Modifying fields

Custom and report fields can be dynamically added, removed (by making them invisible), made mandatory or read only.

Adding new field

To add a new field, at least field_type and name keys must present:

$ curl -H "X-Planado-API-Key:XXX" \
       -X PATCH \
       --data "{\"report_fields\": [{\"name\": \"New input field\", \"field_type\": \"input\"}]}" \
       https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
{
  "job_uuid": "8070f98d-b3f6-4cc8-b7c4-54b6709cd98b"
}

Making existing field required

$ curl -H "X-Planado-API-Key:XXX" \
       -X PATCH \
       --data "{\"report_fields\": [{\"name\": \"Existing\", \"required\": true}]}" \
       https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
{
  "job_uuid": "8070f98d-b3f6-4cc8-b7c4-54b6709cd98b"
}

Hiding existing field

$ curl -H "X-Planado-API-Key:XXX" \
       -X PATCH \
       --data "{\"report_fields\": [{\"name\": \"Existing\", \"hidden\": true}]}" \
       https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
{
  "job_uuid": "8070f98d-b3f6-4cc8-b7c4-54b6709cd98b"
}

Making existing field read only

$ curl -H "X-Planado-API-Key:XXX" \
       -X PATCH \
       --data "{\"report_fields\": [{\"name\": \"Existing\", \"read_only\": true}]}" \
       https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
{
  "job_uuid": "8070f98d-b3f6-4cc8-b7c4-54b6709cd98b"
}