How to Sync Intranet Data
This guide covers the practical steps for pushing data from an external intranet system into the Wippidu app.
Overview
The sync works in two phases:
- Push data — External system sends data to the API → stored in staging tables
- Process data — Admin triggers processing → staging data transforms into app tables
Prerequisites
- An API token (created at
/admin/tokens) - The external system's IP in the token's allowlist (if configured)
Create an API token
- Log in as Admin
- Navigate to
/admin/tokens/new - Set a friendly name (e.g., "Intranet Production")
- Optionally set IP allowlist:
10.0.0.0/8, 192.168.1.100 - Save and copy the token (shown only once)
Push data via API
All endpoints require Bearer token authentication. Push data in dependency order:
TOKEN="your-api-token-here"
BASE="https://app.example.com"
# 1. Push locations
curl -X POST "$BASE/api/intranet/location" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{"einrichtungs_id": "L001", "name": "Kita Sonnenschein", "adresse": "Hauptstr. 1"}
]
}'
# 2. Push groups (requires locations)
curl -X POST "$BASE/api/intranet/group" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{"gruppen_id": "G001", "einrichtungs_id": "L001", "name": "Schmetterlinge"}
]
}'
# 3. Push persons (children, parents, employees)
curl -X POST "$BASE/api/intranet/person" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{"external_id": "K001", "vorname": "Emma", "nachname": "Müller", "rolle": "1"}
]
}'
# 4. Push group assignments
curl -X POST "$BASE/api/intranet/belegung/krp" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{"id_krp": "B001", "kind_id": "K001", "gruppen_id": "G001", "status": 3}
]
}'
# 5. Push parent-child relationships
curl -X POST "$BASE/api/intranet/parent-child" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"records": [
{"eltern_id": "P001", "kind_id": "K001", "von": "2023.01.01"}
]
}'
# 6. Push employees, location leads, group leads...
Trigger processing
- Navigate to
/admin/sync - Review pending record counts
- Click "Process All" (processes in dependency order)
- Or process individually: Locations → Groups → Children → Child-Group assignments
Testing locally
# Test with a local server
curl -X POST http://localhost:8080/api/intranet/location \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"records": [{"einrichtungs_id": "TEST1", "name": "Test Location"}]}'
# Test with invalid token (expect 401)
curl -X POST http://localhost:8080/api/intranet/location \
-H "Authorization: Bearer invalid" \
-H "Content-Type: application/json" \
-d '{"records": []}'
Error handling
Missing dependency (e.g., group without its location):
{
"DataType": "group",
"RecordsTotal": 2,
"Created": 1,
"Skipped": 1,
"Errors": ["Skipped group G002: location L999 not found"]
}
Invalid payload:
{
"success": false,
"error": {
"code": "INVALID_PAYLOAD",
"message": "Field validation for 'ExternalID' failed on the 'required' tag"
}
}
Configure daily employee group sync
For real-time group assignments (e.g., substitute teachers), configure the outbound intranet API:
- Navigate to
/admin/settings - Go to the Intranet tab
- Configure:
- Enable Intranet Sync: Toggle on
- API URL: Full URL to the intranet groups endpoint
- API Token: Token for authenticating with the intranet
Test the connection
Use the Test Connection button with a known employee ID to verify: - The API is reachable - The token is valid - The response format is correct
How it works
When an intranet-linked employee (one with ExternalID set) logs in:
- App checks if they've been refreshed today
- If not, calls the intranet API with their
Mitarbeiter_ID - Receives JSON with group assignments and
Stammteamflags - Stores assignments in
employee_daily_groups - Updates
intranet_refresh_dateon the user
Troubleshooting
Employee doesn't see their group's children:
- Check users.external_id matches the intranet Mitarbeiter_ID
- Check groups.external_id matches the intranet Gruppen_ID
- Check /admin/settings → Intranet settings are configured
- Check the user's intranet_refresh_failed flag
Refresh fails silently: - Enable debug logging to see API request/response details - Check network connectivity to the intranet API - Verify token format (must be accepted as Bearer token AND form field)
Related
- Intranet Sync API Reference — Full endpoint and table documentation
- Intranet Sync Design — Architecture rationale