Hi
I call https://www.patreon.com/api/oauth2/v2/identity?fields[user]=email&include=memberships.currently_entitled_tier
but it returns a bunch of unrelated information:
"included": [
{
"attributes": {},
"id": "a8dc2f19-ca7a-41c8-a257-8f772ed1d13e",
"relationships": {
"currently_entitled_tiers": {
"data": [
{
"id": "9173121",
"type": "tier"
}
]
}
},
"type": "member"
},
{
"attributes": {},
"id": "ed0e4f39-604d-46e0-beca-135797169bf5",
"relationships": {
"currently_entitled_tiers": {
"data": [
{
"id": "1211205",
"type": "tier"
}
]
}
},
"type": "member"
},
{
"attributes": {},
"id": "9173121",
"type": "tier"
},
{
"attributes": {},
"id": "1211205",
"type": "tier"
}
I am mainly interested in how to obtain the reward title so I can grant users their purchased rewards.
Currently all I see is tier ID 1211205 and tier ID 9173121 are printed, and I have no idea what that means. Why are there two rewards listed when I only have purchased one tier?
API V2 is so confusing. I didn’t think multiple tiers were possible… How do I know what Tier ID is active and corresponds to the actual tier name?
Or where do I find a table to reference the Tier IDs to Reward names? Please help, I have been at this for 10 hours since my patrons no longer have access to my apps now that API V1 is no longer working reliably. I have to update my app ASAP and have had no sleep, I have found nothing in API documentation that mentions Reward ID/Title lookup.
thankyou
Members are normally entitled to all the rewards from lower tiers than theirs.
You can pull your tiers via the api by querying /campaigns and then match the tier info to the tier info in the members’ details.
The WordPress plugin’s api calls can provide you helpful examples:
Thank you.
I tried changing the URI by adding ,memberships.campaign to: https://www.patreon.com/api/oauth2/v2/identity?fields[user]=email&include=memberships.currently_entitled_tiers,memberships.campaign
But there are still no mentions of the rewards or tier titles in the returned results. Am I missing something?
I saw field for Related, I think that’s what I need. But i still don’t see the Reward Titles
I managed to solve the issue in a single query. Turns out there is a “Title” field. Here’s a example:
Scope Header:
string patRequest2="https://www.patreon.com/oauth2/authorize?"
+"response_type=code"+"&client_id="+client_id
+"&redirect_uri="+redirect_uri+":"+port.ToString()+"/"
+"&scope=identity%20identity%5Bemail%5D";
Query URI:
https://www.patreon.com/api/oauth2/v2/identity?include=memberships.currently_entitled_tiers&fields[user]=email&fields[tier]=title
Returned Result:
{
"data": {
"attributes": {
"email": "email@gmail.com"
},
"id": "89625331",
"relationships": {
"memberships": {
"data": [
{
"id": "...-8f772ed1d13e",
"type": "member"
}
]
}
},
"type": "user"
},
"included": [
{
"attributes": {},
"id": "...-8f772ed1d13e",
"relationships": {
"campaign": {
"data": {
"id": "3501000",
"type": "campaign"
},
"links": {
"related": "https://www.patreon.com/api/oauth2/v2/campaigns/3501000"
}
},
"currently_entitled_tiers": {
"data": [
{
"id": "9173000",
"type": "tier"
}
]
}
},
"type": "member"
},
{
"attributes": {},
"id": "3501000",
"type": "campaign"
},
{
"attributes": {
"title": "MyCustomReward"
},
"id": "9173000",
"type": "tier"
}
],
"links": {
"self": "https://www.patreon.com/api/oauth2/v2/user/89625000"
}
}
Yes, fields specifically have to be requested.