Skip to main content

Authentication

Session token (Authorization: Bearer <token>) with the parsers:write permission. Tenant roles with it: company_admin, company_tech, operational_supervisor, corporate_client.
The integration API key (x-wede-api-key) has no parsers:* permission. Calls with an API key return 403 forbidden.

Create a model or a version

Creates the next version of the model model_code: version 1 for a new model, otherwise the highest version of the model plus one. Versions never change once created; to change the fields of a model you create its next version, here or with Update a parser. The new version becomes the active version of its model when you send activate: true, or when the model has no active version yet. It then replaces the version that was active. Otherwise it is created inactive and you can activate it later.

Body

string
required
Vertical code, 2 to 50 characters, lowercase letters and _ only. The vertical must be enabled for your organisation.
string
required
Code of the model, 1 to 4 lowercase letters or digits. A code belongs to one vertical of your tenant: it cannot be used in another vertical.
string
required
2 to 100 characters.
string
Up to 500 characters.
object[]
required
2 to 50 field definitions. It must include the integrity core: fields named event_id and timestamp, enabled, required and sent by SMS.
boolean
true makes this version the active version of the model. false creates it inactive, and skips the event type check below.

Field definition

string
required
Stable identifier of the field, 1 to 64 characters, unique in the schema. Versions are compared field by field using id.
string
required
Field name: a lowercase letter, then up to 39 lowercase letters, digits or _. Unique in the schema.
string
required
Label shown to people, 1 to 60 characters.
string
required
Short code of the field in compact frames: a lowercase letter, then up to 3 lowercase letters or digits. Unique in the schema.
string
required
string, number, boolean, gps, text, timestamp, enum, phone, email, address or hardware_id.
integer
required
Maximum size of the value in bytes, from 1 to 160. For an enum field wede sets it to the length of its longest option code.
string
default:"custom"
core, location, human, hardware, team or custom.
string
default:""
Up to 300 characters.
boolean
default:"true"
Whether the field is in use. A disabled field is not shown to the team, is not sent by SMS, is not required and cannot be the type field.
boolean
default:"true"
Whether the team in the field sees the value.
boolean
default:"true"
Whether the value travels in compact frames (SMS and other compact channels).
boolean
default:"false"
Whether the field must be filled.
boolean
default:"false"
Marks the field as personal data. It is a label only: you decide whether the field is enabled and whether it travels by SMS.
boolean
default:"false"
Marks the type field: the enum field whose options set the event type. One per schema at most.
object[]
Only for enum fields, which need 1 to 64 options. Each option has code (1 to 4 uppercase letters or digits, unique in the field), label (1 to 60 characters) and, optionally, action_code (1 to 50 letters, digits or _): the code of the event type in your catalog that the option creates. Without action_code, the type code is the option code in lowercase.
boolean
default:"false"
Once stored as true, the field cannot be removed or disabled in later versions. You can set it in version 1 of a model; in later versions only wede can change the flag, also on a field you add. See field protection.

Checks

  • Size. Every enabled field sent by SMS, filled to its max_bytes, must fit in 32 SMS segments. The response carries sms_size, as in List parsers.
  • Event types. Unless you send activate: false, every option of the type field must point to an active event type of the vertical in your catalog.
  • Field protection. A version after the first must respect the field protection of the active version of the model.

Example

Values in this example are illustrative.

Response 201

The new version, as in List parsers, with defaults applied to each field and its sms_size.

Errors


Create from a factory model

Creates version 1 of a wede factory model in your tenant, with its fields. When you already have that model (not archived), nothing is created and you get your active version, or your newest version if none is active. See List the factory models.
string
required
Vertical code. The vertical must be enabled for your organisation.
string
The factory model to use. Without it, the first factory model of the vertical.
Returns 201 with the new version, or 200 with the version you already had.