Body: <p>I'd like to add a button that adds a contact to a specific group to a Search Kit display. Is there an URL I can specify in the display with the contact id?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T18:47:10.733Z
Comments.Text: I don't think so. You could do it with rest api but you might run into quote-hell or escape-hell, and you'd have to probably enable authx so that you don't have to expose the site key, e.g. something like `entity=GroupContact&action=create&json=%7B%22group_id%22%3A%22Newsletter%20Subscribers%22%2C%22contact_id%22%3A8%7D&some_kind_of_credentials_or_signal_to_authx`. And that probably won't work since it needs to be POST not GET. You never really want to allow urls that change anything via GET, since then otherwise search engines or phones that pre-fetch would constantly be changing your data!
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T22:45:10.373Z
Comments.Text: Any reason you need it to be a button? That feature is available in the actions drop-down
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-30T02:59:03.907Z
Comments.Text: Just looking to cut down on clicks for some repetitive tasks. Currently, I have /civicrm/contact/view?reset=1&cid=[id]&selectedChild=group, from where it isn't a huge effort to add to a specific group, but it would be nice to do this without having to select the group each time, since it is always the same. Actions drop down works, but similar in terms of process to what I have now.
Comments.UserDisplayName: Lars SG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-30T05:23:30.243Z
Comments.Text: @Coleman I thought I had a clever solution: Search with Contact Group if Group ID = a specific group, then add an edit in place Group Status field. In theory, you can just click to edit and change to Added to add the contact to the group, which would be very quick. This looks like it works (you can edit the field and save it) but nothing changes after saving.
  Does this seem like it should work and something's buggy or there's some reason this won't work?
Comments.UserDisplayName: Lars SG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-01T16:21:46.070Z
Comments.Text: That seems like it ought to work but maybe there is another required field missing?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-02T03:09:16.417Z
Comments.Text: Even with Group ID and Contact ID in the table, it doesn't work. For contacts that already have a status in the group, it just doesn't update, not sure why (no errors). For contacts that don't have a status in the group, it looks like it doesn't know which group to add to (getting an error about something undefined).
Comments.UserDisplayName: Lars SG
Tags: <groups>
Title: Can a contact be added to a group by URL?
ThreadText: # Can a contact be added to a group by URL?
  
  (Asked by: username_0 on 2022-09-29)
  
  I'd like to add a button that adds a contact to a specific group to a Search Kit display. Is there an URL I can specify in the display with the contact id?
  
  **Tags:** groups
  
  > **Comments:**
  > **username_1**: I don't think so. You could do it with rest api but you might run into quote-hell or escape-hell, and you'd have to probably enable authx so that you don't have to expose the site key, e.g. something like `entity=GroupContact&action=create&json=%7B%22group_id%22%3A%22Newsletter%20Subscribers%22%2C%22contact_id%22%3A8%7D&some_kind_of_credentials_or_signal_to_authx`. And that probably won't work since it needs to be POST not GET. You never really want to allow urls that change anything via GET, since then otherwise search engines or phones that pre-fetch would constantly be changing your data!  
  > **username_2**: Any reason you need it to be a button? That feature is available in the actions drop-down  
  > **username_0**: Just looking to cut down on clicks for some repetitive tasks. Currently, I have /civicrm/contact/view?reset=1&cid=[id]&selectedChild=group, from where it isn't a huge effort to add to a specific group, but it would be nice to do this without having to select the group each time, since it is always the same. Actions drop down works, but similar in terms of process to what I have now.  
  > **username_0**: @username_2 I thought I had a clever solution: Search with Contact Group if Group ID = a specific group, then add an edit in place Group Status field. In theory, you can just click to edit and change to Added to add the contact to the group, which would be very quick. This looks like it works (you can edit the field and save it) but nothing changes after saving. Does this seem like it should work and something's buggy or there's some reason this won't work?  
  > **username_2**: That seems like it ought to work but maybe there is another required field missing?  
  > **username_0**: Even with Group ID and Contact ID in the table, it doesn't work. For contacts that already have a status in the group, it just doesn't update, not sure why (no errors). For contacts that don't have a status in the group, it looks like it doesn't know which group to add to (getting an error about something undefined).  
  
  ---
  
  ## 0 answers
  
  