ref
LogicGenerate foreign key references to another table's output. THE KILLER FEATURE — creates proper relational integrity across tables. Every order references a real user ID, every comment references a real post. No orphan records.
Example Outputs
a1b2c3d4-e5f6-4890-abcd-ef1234567890142Parameters
| Parameter | Description |
|---|---|
| table | Referenced table name (required) |
| field | Referenced field name (required) |
| distribution | uniform or power_law |
API Usage
Send a POST request to generate ref (foreign key) data:
curl -X POST https://mockhero.dev/api/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tables": [
{
"name": "example",
"count": 5,
"fields": [
{
"name": "ref",
"type": "ref",
"params": {
"table": "users",
"field": "id"
}
}
]
}
]
}'Common Use Cases
- Relational data seeding
- Foreign key integrity
- Multi-table schemas
- Database seed scripts
Quick Info
- Field Type
- ref
- Category
- Logic
- Parameters
- 3 parameters
- Output Format
- JSON, CSV, SQL
Generate Ref (Foreign Key) + 155 more types via API
One API call. Multiple tables. Relational integrity. Free tier included.