Skip to main content

Setup Metadata

Many Weave objects carry a type: a program has a program type, a currency a currency type, a target a counter or completion type. Weave doesn't ship a fixed list of these. Each organization defines its own values, so they describe its business in its own words, and an object names one by code. Create the values an object needs before you create the object.

Before you create anything​

  1. Look for what the organization already has. GET /metadata?typeCode=PROGRAM_TYPE lists the organization's program types, and the same works for every metadata type below. Reuse a value that fits rather than adding a near-duplicate.
  2. Otherwise, create a value named for the business. Pick a code the team will recognize in reports and the Hub: POINTS_PROGRAM or FREQUENT_FLYER for a program type, POINTS, MILES or VISITS for a currency type. Ask whoever runs the program when the right name isn't clear.
  3. Then create the object with that code.

An object that names a value the organization hasn't defined is refused with a 400 (for example PROGRAM_TYPE_UNRESOLVED), and where the message can, it lists the values that exist.

Metadata values​

Create these with POST /metadata, where typeCode is the metadata type and code and name are your value:

curl -X POST $LOOM/metadata \
-H "Authorization: Bearer $LOOM_API_KEY" -H "Content-Type: application/json" \
-d '{ "typeCode": "PROGRAM_TYPE", "code": "POINTS_PROGRAM", "name": "Points program" }'
You're creatingFieldMetadata type
ProgramtypeCodePROGRAM_TYPE
Program currencycurrencyTypeCodeCURRENCY_TYPE
PartnertypeCodePARTNER_TYPE
Counter targetcounterTargetTypeCodeCOUNTER_TARGET_TYPE
Completion targetcompletionTargetTypeCodeCOMPLETION_TARGET_TYPE
Milestone targetmilestoneTargetTypeCodeMILESTONE_TARGET_TYPE
X of Y targetxofYTargetTypeCodeX_OF_Y_TARGET_TYPE
Customer grouptypeCodeCUSTOMER_GROUP_TYPE
Customer identifiertypeCodeCUSTOMER_IDENTIFIER_TYPE

GET /metadata-types?category=METADATA lists every metadata type in the organization, including ones a package or your team added.

Data types​

Event, badge and coupon types also carry a data model, so they are created with POST /data-types instead:

You're creatingFieldType code
Event rule, event, floweventTypeCodeEVENT_TYPE
BadgetypeCodeBADGE_TYPE
Coupon offer (optional field)couponTypeCodeCOUPON_TYPE

An event type names the data model that lists its fields; the Quick Start walks through one.