Directory sync LIVE

Two nightly jobs most institutions want: keep cost-center / WBS codes valid automatically, and administer group memberships when your directory can't map users to OpenIRIS groups on its own.

Cost centers (WBS codes)

Scopes: billing:read for reads, cost-centers:write for create/inactivate.

The sync recipe — diff by code, create on miss, inactivate on invalidation:

# 1. Does the code exist?
GET /v1/cost-centers?filter[code]=WBS4711

# 2a. Miss → create it (provider_id only needed on multi-provider keys)
POST /v1/cost-centers
Idempotency-Key: …
{ "code": "WBS4711", "name": "Microscopy core 2026" }

# 2b. Code no longer valid in SAP → inactivate (never delete)
GET  /v1/cost-centers/4501                # take the ETag from the response
PATCH /v1/cost-centers/4501
Idempotency-Key: …
If-Match: W/"9F27C1D44A50B1E3…"
{ "status": "inactive" }

Rules the API enforces for you:

Group memberships

Scopes: users:read for reads, groups:write for member administration. Your key sees the groups of organisations that trust your provider(s).

GET    /v1/groups?filter[name][contains]=biology
GET    /v1/groups/8100/members

POST   /v1/groups/8100/members          # add — idempotent
Idempotency-Key: …
{ "user_id": 20117 }

DELETE /v1/groups/8100/members/20117    # remove — idempotent
There is deliberately no "replace all members" call. Group membership drives both access and billing attribution; a single faulty sync run against a replace-all endpoint would empty a group. Diff on your side and apply individual add/remove calls — both are idempotent, so partial failures are safely re-runnable.

Job hygiene