How do I use the API to unsubscribe a user from an item?
Using the Ruby API, I need to unsubscribe a user from hundreds of items. However, I am receiving an error.
For the un*subscribe, this call is producing an error:
* Podio::Subscription.delete(301768399) **
- The user with id 1135842 does not have the right delete on subscription with id 301768399 (Podio::AuthorizationError) *
However, because I have the user's login credentials, I can successfully subscribe the user to an item, as in here:
** Podio::Subscription.create("item", 301768399) **
So....How does one remove a specific user's subscription to an item, without tampering with any other users' subscriptions who might be subscribed to that same item?
I can only guess from your description, but when you try to unscubscribe the user, are you using a different user's credentials to make that call? Because only the user herself can unsubscribe. (You can basically think of it in terms of the Web GUI: you cannot unsubscribe another user. The API also doesn't let you do that.)
dieKollaborateure.com - Podio Training+Consulting+Development English & Deutsch
I'm sorry; apparently I wasn't clear. I have the user's login and password which I am using to authenticate in the API. Here's the code snippet:
c = Podio.client.authenticate_with_credentials('firstname.lastname@example.org', 'pass123')
Again, I use the same authentication method to subscribe the user to the Podio item, I just can't unsubscribe the user. Does that help?
I understand what you're saying about the API restrictions and the similarity to the Web GUI.
Thanks for any follow up answer you could provide.
sorry for not noticing earlier: I believe you are trying to use the wrong API method. You use Subscription.delete(), which expects a subscription_id, but you are supplying the item_id. So, you probably want to use
Subscription.delete_by_reference()instead (where you can specify the ref_typ, i.e. "item" and then use the item_id). Here is a link to the API docs for this.
Please sign in to leave a comment.