when i try to use og_services to retrieve groups(subscribed by user) its working fine
but when i try to call join/leave it shows 404 (Not found : Could not find the controller.)

Comments

Sylense’s picture

I've found that this module is pretty poorly documented and doesn't appear to work well with the latest version of OG (7.x-2.7). There are functions it calls that no longer exist in OG.

In order to join a user to an organic group testing with Postman the following endpoint works for me:
http://MYSITEURL/MYENDPOINT/og/join

Then the data I post is as follows (JSON format)

{
    "uid": "USER ID HERE",
    "gid": "GROUP ID HERE"
}

This will get you passed the controller not found error but you will likely get additional errors because the functions it calls to subscribe a user to a group no longer exist. The calls to og_get_group_membership() and og_membership_create() are incorrect. I have changed some code in order to get it to work. Once I can fully test it I will try and post a patch.

I'm almost to the point where I'm considering just rewriting my own custom resources for OG because there are too many complications with this module.

tyler.frankenstein’s picture

Status: Active » Closed (duplicate)

I've fixed this problem in this issue #2672148: Improve module quality, and changed it to use the URL path (for better access control) instead of POST data (even though you still make an empty POST to use it):

?q=[endpoint]/og/join/[gid]/[uid]
?q=[endpoint]/og/leave/[gid]/[uid]

I've applied for co-maintainership, so I hope to make a new dev release with this fix soon.