Rewards data not included in API response

Hi there,

/oauth2/api/campaigns/ID/pledges?include=rewards,creator,goals,pledges

In above API endpoint previously we received the rewards for the appropriate pledges. Recently the responses are not including the rewards data. Is there anything changed recently?

1 Like

Seems to work fine for me. Any chance of a typo in the actual request?

It can’t be a typo for two reasons.

  1. We are getting the URL from campaigns API response value at data >> relationships >> pledges >> links >> first. And not using the raw URL directly in the code.

  2. It is untouched working code for more than 2 weeks. But the problem is raising now only.

Below is the URL we receiving from campaigns API endpoint /oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges.

https://www.patreon.com/api/oauth2/api/campaigns/[ID]/pledges?include=rewards%2Ccreator%2Cgoals%2Cpledges&page%5Bcount%5D=100

Edit: Again I rechecked it. Sure I am not receiving the values at data >> type: pledge >> relationships >> reward.

1 Like

This happened a few days ago:

If you were using the Links provided and adding on your own include and field query parameters, this might be screwing things up if those parameters are now already in the link. Seems to coincide when things started going wrong for you?

1 Like

Great catch! Things went wrong exactly after the time of that post.

I am not adding anything extra. I just using the link what they provided.

1 Like

If you were not adding anything extra, then how were you getting the includes? Previously, the links that they provided did not have any of the include or field query parameter.

Perhaps with these changes, rewards aren’t added in by default anymore. Either way, you probably want to verify and modify the link that they are giving you.

At last I found the problem.

I am adding include param in the API call of campaigns endpoint like '/api/current_user/campaigns?include=rewards,creator,goals,pledges&page[count]=100'.

In the response the same include param automatically added into the values at data >> relationships >> pledges >> first & next.

Like /api/campaigns/[ID]/pledges?include=rewards,creator,goals,pledges&page%5Bcount%5D=20&sort=created.

Both are different API endpoints. First one’s include param shouldn’t added to the second. Is it a bug :bug:? yes

Now I have to do like below

uri.sub("include=rewards%2Ccreator%2Cgoals%2Cpledges&", "");
1 Like

Great catch, @vinkas. This is definitely a bug. I’ll merge a fix ASAP.

2 Likes

After further investigation, it’s become clear that this is a larger issue which requires a more holistic approach to fix. I don’t feel comfortable leaving it in this buggy state, so I’m going to revert the “remember query params in includes” feature. We’ll be addressing this issue in the following weeks. You can expect a revert in the next hour. Sorry about this :frowning:

2 Likes