Skip to content

Giving API: Cannot update labels on Planning Center online-giving donations via Donation PATCH #1482

Description

@mattmeccadata

Related Product
API / Giving

Describe the question
I’m trying to update the labels on Giving donations through the API.

According to the Giving Donation API documentation, PATCH /giving/v2/donations/{id} supports replacing associated labels by passing a labels key in the relationships object.

This works for donations that were manually entered / batch processed in Planning Center Giving. However, it fails with a 403 Forbidden for donations that were submitted directly through a Planning Center donation form / online giving flow.

The online-giving donations can be read successfully, and their labels can be listed successfully, but attempting to update the donation’s labels through the documented donation PATCH endpoint fails.

The error returned is:

{
  "errors": [
    {
      "status": "403",
      "title": "Forbidden",
      "detail": "You do not have access to this resource",
      "meta": {
        "description": "User with id _<id>_ cannot update AppGraph::V2019_10_18::Vertices::DonationVertex with id _<id>_."
      }
    }
  ]
}

The API credentials being used are account-admin credentials with Giving access. The same credentials can successfully update labels on manually entered / batch donations.

My question: Is there a supported API method to add/remove existing labels from donations that were processed through Planning Center online giving? Or are Planning Center-source donations intentionally not updateable via the donation PATCH endpoint, even for label-only relationship changes?

What have you tried that worked?

  • GET /giving/v2/donations/{donation_id} works.
  • GET /giving/v2/donations/{donation_id}/labels works for the affected online-giving donations.
  • PATCH /giving/v2/donations/{donation_id} with relationships.labels works for donations that were manually entered / batch processed.
  • The same API credentials successfully update labels on manually entered / batch donations.

Example successful label read for an affected online-giving donation:

GET /giving/v2/donations/{id}/labels

returns 200 with labels including:

[
  {
    "type": "Label",
    "id": "_<id>_",
    "attributes": {
      "slug": "acknowledge-needs"
    }
  },
  {
    "type": "Label",
    "id": "_<id>_",
    "attributes": {
      "slug": "source-planning-center"
    }
  }
]

What have you tried that didn't work?

  1. Updating labels through the documented donation PATCH endpoint:
PATCH /giving/v2/donations/{id}
Content-Type: application/json

with a payload shaped like:

{
  "data": {
    "type": "Donation",
    "id": "_<id>_",
    "relationships": {
      "labels": {
        "data": [
          { "type": "Label", "id": "_<id>_" },
          { "type": "Label", "id": "_<id>_" },
          { "type": "Label", "id": "_<id>_" },
          { "type": "Label", "id": "_<id>_" },
          { "type": "Label", "id": "_<id>_" }
        ]
      }
    }
  }
}

This fails only for donations processed through Planning Center online giving, with:

{
  "status": "403",
  "title": "Forbidden",
  "detail": "You do not have access to this resource",
  "meta": {
    "description": "User with id _<id>_ cannot update AppGraph::V2019_10_18::Vertices::DonationVertex with id _<id>_."
  }
}
  1. Trying a JSON:API-style relationship endpoint:
POST /giving/v2/donations/_<id>_/relationships/labels

This returns:

{
  "errors": [
    {
      "status": "404",
      "title": "Not Found",
      "detail": "The resource you requested could not be found"
    }
  ]
}
  1. Trying to POST to the labels association endpoint:
POST /giving/v2/donations/_<id>_/labels

This returns a 403, and appears to be interpreted as an attempt to create a new Label rather than attach an existing Label:

{
  "errors": [
    {
      "status": "403",
      "title": "Forbidden",
      "detail": "You do not have access to this resource",
      "meta": {
        "description": "User with id _<id>_ cannot create a Label."
      }
    }
  ]
}

Additional context

The goal is to automate acknowledgment workflow labels on donations.

Current workflow:

  • Donations with label acknowledge-needs should have that label removed.
  • Label acknowledge-done should be added.
  • The label update works for manually entered / batch donations.
  • The label update fails for donations submitted directly through Planning Center online giving.
  • The affected online-giving donations include a label like source-planning-center.

I’m trying to determine whether this is expected behavior, a permissions issue, or whether there is another supported endpoint for assigning existing labels to online-giving donations without updating the full Donation resource.

I have..

  • Reviewed the documentation found at https://developer.planning.center/docs
  • Searched for previous issues answering this question
  • 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

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions