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
- Look for what the organization already has.
GET /metadata?typeCode=PROGRAM_TYPElists 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. - Otherwise, create a value named for the business. Pick a code the team will recognize in reports and the Hub:
POINTS_PROGRAMorFREQUENT_FLYERfor a program type,POINTS,MILESorVISITSfor a currency type. Ask whoever runs the program when the right name isn't clear. - 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 creating | Field | Metadata type |
|---|---|---|
| Program | typeCode | PROGRAM_TYPE |
| Program currency | currencyTypeCode | CURRENCY_TYPE |
| Partner | typeCode | PARTNER_TYPE |
| Counter target | counterTargetTypeCode | COUNTER_TARGET_TYPE |
| Completion target | completionTargetTypeCode | COMPLETION_TARGET_TYPE |
| Milestone target | milestoneTargetTypeCode | MILESTONE_TARGET_TYPE |
| X of Y target | xofYTargetTypeCode | X_OF_Y_TARGET_TYPE |
| Customer group | typeCode | CUSTOMER_GROUP_TYPE |
| Customer identifier | typeCode | CUSTOMER_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 creating | Field | Type code |
|---|---|---|
| Event rule, event, flow | eventTypeCode | EVENT_TYPE |
| Badge | typeCode | BADGE_TYPE |
| Coupon offer (optional field) | couponTypeCode | COUPON_TYPE |
An event type names the data model that lists its fields; the Quick Start walks through one.