Answers.Body: <p>The mailing list is actually a group in CiviCRM. The functionality of a group is bit more than just mailing list, but fine if you only want to use it for that. </p>
  
  <p>It means that all you have to do is add the contact to the relevant group using the GroupContact API AFAIK.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-04T10:53:53.880Z
Answers.Text: So if I understand it correct 'MailingEventSubscribe' is not the right entity, maybe 'Group' or even 'GroupContact' is the right one then.
Answers.UserDisplayName: zlat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-04T12:40:14.563Z
Answers.Text: GroupContact is the right one, that adds a contact to a group. There is an example here: https://pastebin.com/StqnyrdY
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-04T10:19:06.817Z
Answers.LastActivityDate: 2018-07-04T10:19:06.817Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I am trying to subscribe a user to a mailing list through the REST API.
  I understand that I need to create a Contact first, then subscribe it to a given mailing list. While I can create the contact, I can't subscribe it to the list using parameters:</p>
  
  <p><code>entity: 'MailingEventSubscribe'
  action: 'create'
  email: [the-contact-email-here]
  group_id: [the-mailing-list-group-id-here]</code></p>
  
  <p>This will result in 
  <code>{"is_error":1,"error_message":"Subscription failed"}</code></p>
  
  <p>The CiviVRM version here is 4.2.0
  I could't find documentation for the API on this specific version, so I'm playing the guessing game here :). I've been also told that the API requests can be chained somehow in order to do just 1 instead of 2, is there a documentation for this?</p>
  
  <p>Can someone point me into the right direction? Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-09T08:40:32.090Z
Comments.Text: A lot has happened in the Civi world since 4.2.0.  I'd strongly recommend upgrading.
Comments.UserDisplayName: Aidan
Tags: <mailing><rest>
Title: Subscribe to mailing list through the API
ThreadText: # Subscribe to mailing list through the API
  
  (Asked by: username_0 on 2018-07-04)
  
  I am trying to subscribe a user to a mailing list through the REST API.
  I understand that I need to create a Contact first, then subscribe it to a given mailing list. While I can create the contact, I can't subscribe it to the list using parameters:
  
  `entity: 'MailingEventSubscribe'
  action: 'create'
  email: [the-contact-email-here]
  group_id: [the-mailing-list-group-id-here]`
  
  This will result in
  `{"is_error":1,"error_message":"Subscription failed"}`
  
  The CiviVRM version here is 4.2.0
  I could't find documentation for the API on this specific version, so I'm playing the guessing game here :). I've been also told that the API requests can be chained somehow in order to do just 1 instead of 2, is there a documentation for this?
  
  Can someone point me into the right direction? Thanks.
  
  **Tags:** mailing, rest
  
  > **Comments:**
  > **username_1**: A lot has happened in the Civi world since 4.2.0.  I'd strongly recommend upgrading.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-07-04. Score: 0 | Accepted answer
  
  The mailing list is actually a group in CiviCRM. The functionality of a group is bit more than just mailing list, but fine if you only want to use it for that.
  
  It means that all you have to do is add the contact to the relevant group using the GroupContact API AFAIK.
  
  > **Comments:**
  > **username_0**: So if I understand it correct 'MailingEventSubscribe' is not the right entity, maybe 'Group' or even 'GroupContact' is the right one then.  
  > **username_2**: GroupContact is the right one, that adds a contact to a group. There is an example here: https://pastebin.com/StqnyrdY  
  
  ---
  
  