GET /schema/<Type>/fields
get_schema_type_fields
Every field on one type with its data_type, editable and mandatory. The expensive call at 48KB and ~330ms, so fetch the types you need and never loop the /schema listing into it.
API
Params
| part | value |
|---|---|
project_id |
optional. Adds hidden_values to every list and status field (probe 009) and makes every visible.value that project's (probe 115) |
Sample requests
r = c.get("/schema/Version/fields")
Keyed by programmatic field name. On the probed site, Version has 71 fields in 47958 bytes:
{
"data": {
"code": {
"name": { "value": "Version Name", "editable": true },
"entity_type": { "value": "Version", "editable": false },
"data_type": { "value": "text", "editable": false },
"editable": { "value": true, "editable": false },
"mandatory": { "value": true, "editable": false },
"unique": { "value": false, "editable": false },
"properties": { "default_value": { "value": null, "editable": false } }
}
}
}
Which fields a client may write:
f = c.get("/schema/Version/fields").json()["data"]
print([k for k, v in f.items() if v["editable"]["value"]])
Response codes
| status | when |
|---|---|
| 200 | the type is enabled |
| 404 | Entity type 'X' does not exist. |
Edge cases
mandatoryis not the create contract.codereadsmandatory: trueand a create omitting it succeeds at 201 with a server-invented name;projectreadsmandatory: falseand a create omitting it is 400. Read the create contract from the entity-type card, not from this flag.- Every value is wrapped in
{value, editable}, and the outereditablesays whether you may change the property, not whether you may write the field.data["code"]["editable"]["value"]is the one that answers "can I write this". - Adding
project_idchanges two things:hidden_valueson list and status fields, andvisible.valueon every field the project hides. On the probed site Version differs by 22 bytes and novisible, while Shot reads 12 fields hidden in one project and 15 in another, none at site scope (probe 115). - A
project_idthat does not exist is a 200 with every field visible, not an error. - 48KB and about 330ms per type. Never loop this over the
/schemalisting.