How is working the API

Hello,

I’ve been fighting with APIv2 for 3 days. I have two questions:

In the documentation, we see the following scopes

identity
identity[email]
identity.memberships
campaigns
w:campaigns.webhook
campaigns.members
campaigns.members[email]
campaigns.members.address

When I add identity[email] and campaigns.members[email], it returns the error.

“Error trying to decode a non urlencoded string. Found invalid characters: {’[’, ‘]’} in the string”

How to use them ?

Second question.

The APIv2 resource endpoint /api/oauth2/v2/members/{id}

What is this {id} ? How to get it ? I just have an access token and it’s not working. I receive the response:

“member with id V8vQuaquV6TdHpfo8z_ranLXY4BxyyjlBqAMMsCXvLM was not found”

Thanks for you help

Just encode [ and ] before sending.

As in (for PHP):

$request = ‘identity?include=memberships&fields’.urlencode(‘[user]’).‘=email,first_name,full_name,image_url,last_name,thumb_url,url,vanity,is_email_verified&fields’.urlencode(‘[member]’).‘=currently_entitled_amount_cents,lifetime_support_cents,last_charge_status,patron_status,last_charge_date,pledge_relationship_start’;

What is this {id} ? How to get it ? I just have an access token and it’s not working. I receive the response:

You either get it from the details of a user which you log in via Patreon, or you list campaigns, get a campaign id, then get members of a campaign, and get those members’ ids (if you dont know the id).

Below PHP functions can be used in official PHP lib. These can be adapted for use for other languages too.

1 Like

Thanks so much, with your help it worked.

For other guys, there is id everywhere, the good one had this pattern:
b4c1d7c1-60a7-4ccc-ad91-181a8ba0ab5b (modified id)

Please avoid posting actual identifiers like user ids or other sensitive information on public forums.