Enable access to credit data in modern drupal json api - anyone currently scraping credit data will need to update

Created on 9 June 2025, 3 months ago

Problem/Motivation

With the contribution credit migration from D7 to modern Drupal, the source of truth for credit data has changed.

In modern Drupal we are providing the data via JSON api

  • /jsonapi/node/contribution_record
  • /jsonapi/paragraph/contributor

With these endpoints:

  • '/contribution-records-by-user'
  • '/contribution-records-by-organization'
  • '/contribution-records-by-organization-by-user'

Proposed resolution

  • We should announce this in our blog about the contribution credit changes
  • Any drupal.org users who use this to do private data gathering about credit will need to update how they do that.
  • Create a documentation page

API changes

Data model changes

🌱 Plan
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hestenet
  • πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ
  • πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Note that the endpoints come from the contributin_records module.

    A really small summary of the endpoints and options available are here: https://git.drupalcode.org/project/contribution_records/tree/1.0.x#endpo...

  • πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ
  • πŸ‡ΊπŸ‡ΈUnited States drumm NY, US
  • πŸ‡ΊπŸ‡ΈUnited States balsama boston

    I'm trying to figure out a way to get an accurate date for when credit was given on a particular issue. In the old API, I could get the date for each of the `issue_credit_comment_info`'s corresponding comments. With the new `contribution_record` endpoint, I only see when the issue itself was created, changed, and last_status_change. None of which give an accurate idea of when the credit was given.

    I'm including `paragraph--contributor`. Perhaps that include could include a date attribute?

    I should note, that outside of this, the new API is great. I'm able to get everything else that I'm looking for in a single request (which took a dozen or more requests with the old API).

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ

    @balsama - A couple of clarifications:

    The date that a comment is made is when the attribution was made by an individual (as volunteer, on behalf of employer, or on behalf of client(s) - but the credit does not actually get *granted* until the issue maintainer has selected who should receive the credit, and the issue is closed.

    So typically the most accurate date of when credit was granted is status_last_changed, whenever status = [any of the closed statuses],

    But maybe in your use case it was important/helpful to know when the attributions were made?

    The issue with having date-per-attribution, is that the new system is designed for when we switchover to GitLab issues, and those won't have attributions per individual comment, instead contributors will be able to edit their attribution for the whole issue on the credit record.

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Yes, what @hestenet said.

    The date when a credit is given is last_status_change and field_draft is set to 0 (which happens when an issue is closed). That's exactly how our internal systems work to grant credit on users, organizations, marketplace.

  • πŸ‡ΊπŸ‡ΈUnited States balsama boston

    Thanks for the clarification. I'm most interested in when a fix was actually committed. And I think in most situations, last_status_change will be ~2 weeks later than the commit date since status generally changes from Fixed --> Closed (Fixed) about two weeks after a fix has been committed.

    And, of course, it can be wildly different if an issue is reopened.

    That said, without getting into the nuance of what I use the API for, I'll generally be requesting commit credit for issues that have just landed based on Git logs. So the last_status_change date will likely still be the change from NR -> Fixed - which is usually the same day the commit was made.

    Thanks again!

Production build 0.71.5 2024