Answers.Body: <p>Okay, I just figured it out. I just need to chain the API call with CustomValue create:</p>
  
  <pre><code>CRM.api3('Participant', 'create', {
    "debug": 1,
    "sequential": 1,
    "event_id": 145,
    "contact_id": 2,
    "role_id": "Attendee",
    "api.CustomValue.create": {"custom_223":3}
  }).done(function(result) {
    // do something
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T20:17:34.483Z
Answers.Text: More simply, just add ``"custom_223": 3``  The API explorer can help with the syntax and with figuring out which custom_N you need
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T08:17:01.900Z
Answers.Text: HI could anyone let me know step by step api developement guide.
Answers.UserDisplayName: Md Maidul Islam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T20:00:41.533Z
Answers.LastActivityDate: 2016-11-30T20:00:41.533Z
Answers.UserDisplayName: Sleewok
Body: <p>I am trying to register event participants from code. I have created a custom field group for "Participants". </p>
  
  <p>Using the API, how can I create a value for the custom fields and have them associated with the event that a contact is registered for?</p>
  
  <p>Thanks!</p>
  
Tags: <civievent><custom-fields><api><registration>
Title: API for Event Registration with Custom Fields?
ThreadText: # API for Event Registration with Custom Fields?
  
  (Asked by: username_0 on 2016-11-30)
  
  I am trying to register event participants from code. I have created a custom field group for "Participants".
  
  Using the API, how can I create a value for the custom fields and have them associated with the event that a contact is registered for?
  
  Thanks!
  
  **Tags:** civievent, custom-fields, api, registration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-11-30. Score: 2 | Accepted answer
  
  Okay, I just figured it out. I just need to chain the API call with CustomValue create:
  CRM.api3('Participant', 'create', {
    "debug": 1,
    "sequential": 1,
    "event_id": 145,
    "contact_id": 2,
    "role_id": "Attendee",
    "api.CustomValue.create": {"custom_223":3}
  }).done(function(result) {
    // do something
  });
  
  > **Comments:**
  > **username_1**: More simply, just add ``"custom_223": 3``  The API explorer can help with the syntax and with figuring out which custom_N you need  
  > **username_2**: HI could anyone let me know step by step api developement guide.  
  
  ---
  
  