REST API

Contents

REST API#

Schema#

The package registers an IJsonSchemaProvider adapter for each text field, in plonegovbr.brfields.serializers.fields. The @types endpoint describes each field as a string, with the widget and the factory below.

Field

Adapter

widget

factory

CEP

CEPJsonSchemaProvider

cep

CEP

CNPJ

CNPJJsonSchemaProvider

cnpj

CNPJ

CPF

CPFJsonSchemaProvider

cpf

CPF

Telefone

TelefoneJsonSchemaProvider

telefone

Telefone

Estados is described as any Choice field, with a vocabulary pointing to @vocabularies/plonegovbr.vocabulary.estados.

{
  "description": "",
  "factory": "CPF",
  "title": "CPF",
  "type": "string",
  "widget": "cpf"
}

Values#

A text field's value is serialized as the string stored. An Estados value is serialized as its term.

{
  "cpf": "37731335453",
  "estado": {
    "title": "Distrito Federal",
    "token": "DF"
  }
}

Errors#

Creating or updating content with a value that is not valid answers 400 Bad Request, and the message names the field.