Skip to content

Trim leading/trailing whitespace on string attributes (API and Church Center) #1493

Description

@Kanetix

Related Product
API

Is your feature request related to a problem? Please describe.

String attributes are stored verbatim, including leading and trailing whitespace. Nothing trims on save, not the API, and not the Church Center UI.

It's cosmetic on most fields, but it bit us on Group.contact_email. Three of our six groups had a trailing space in that field. All three were entered through the Church Center UI, by different people, over a period of time. Nobody noticed, because trailing whitespace is invisible in a text input - the field looks correct.

Two things make it hard to recover from:
Our integration routes group inquiries to contact_email, so those were live addresses carrying a trailing space, and whitespace can break delivery depending on the mail path.
contact_email is not assignable on PATCH (422 "contact_email cannot be assigned"), so we couldn't correct it programmatically. Every fix had to be done by hand, on a value nobody can see.
We only found it because we were auditing the data with a script. Through the UI alone it's effectively undetectable.

Describe the solution you'd like

Trim leading and trailing whitespace from string attributes on save, on both the API and the Church Center UI. contact_email especially, since the value is an address and surrounding whitespace is never meaningful there.

Describe alternatives you've considered

Trimming client-side before we write. Works for values we send, but does nothing about values entered through the Church Center UI by group leaders and staff, which is where all three of ours came from.
Trimming on read in our integration. Doesn't fix the stored data, and pushes the same workaround onto every other consumer of the API.
Fixing by hand in the UI. What we ended up doing. It's the only option for contact_email since it isn't API-writable, and it doesn't prevent recurrence - the next paste puts it right back.
A periodic audit script. How we found it. Works, but it's a lot of machinery for something a .strip() on save would eliminate.
Additional context

Reproduced on both Groups and People, on both POST and PATCH:

Groups - PATCH

curl -u APP_ID:SECRET -X PATCH
'https://api.planningcenteronline.com/groups/v2/groups/{group_id}'
-H 'Content-Type: application/json'
-d '{"data":{"type":"Group","id":"{group_id}","attributes":{"schedule":"Sunday @ 12:15pm "}}}'

-> 200; reading back returns "schedule": "Sunday @ 12:15pm "

People - POST

curl -u APP_ID:SECRET -X POST
'https://api.planningcenteronline.com/people/v2/workflows'
-H 'Content-Type: application/json'
-d '{"data":{"type":"Workflow","attributes":{"name":"trim test "}}}'

-> 201; reading back returns "name": "trim test "

Form.name behaves the same way. Same result entering a trailing space through the Church Center UI.

Since it reproduces on two products across both verbs, I assume it's platform-wide rather than specific to those two, though I've only tested Groups and People.

I saw in #1459 that most of the Groups API is currently read-only and that improvements are being planned, so I'm not raising contact_email write access here. I mention it only because it's what makes the whitespace unrecoverable once it's in. The trimming feels like a separate, smaller thing: a data-quality question at the point of save rather than a missing endpoint.

API versions: Groups 2023-07-10, People 2026-06-04
Authentication: Personal Access Token, organization administrator

I have..

  • [x ] Reviewed the documentation found at https://developer.planning.center/docs
  • Searched for previous issues asking for this feature request
  • [x ] Removed all private information from this issue (credentials, tokens, emails, phone numbers, etc.)
  • Reviewed my issue for completeness

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions