Answers.Body: <p>Md Maidul Islam,</p>
  
  <p>Bit difficult to understand from your question what you want to achieve. </p>
  
  <p>1 - Do you mean to add participant for an event? Then you can use Entity = Participant and Action = Create api</p>
  
  <pre><code>$result = civicrm_api3('Participant', 'create', [
    'event_id' =&gt; 3,
    'contact_id' =&gt; 51,
  ]);
  </code></pre>
  
  <p>2 - Do you mean to add participant for an event with all contact details in one call ? Then you can use Entity = Contact and Action = Create chain api</p>
  
  <pre><code>$params = [
      'display_name' =&gt; 'batman',
      'contact_type' =&gt; 'Individual',
      'api.address.create' =&gt; [
        'contact_id' =&gt; '$value.id',
        'location_type_id' =&gt; 6,
        'street_name' =&gt; 'Ambachtstraat',
        'street_number' =&gt; '23',
        'street_address' =&gt; 'Ambachtstraat 23',
        'postal_code' =&gt; '6971 BN',
        'country_id' =&gt; '1152',
        'city' =&gt; 'Brummen',
        'is_primary' =&gt; 1,
      ],
      'api.email.create' =&gt; [
        'contact_id' =&gt; '$value.id',
        'location_type_id' =&gt; 'Main',
        'email' =&gt; 'api@a-team.com',
        'is_primary' =&gt; 1,
      ],
      'api.phone.create' =&gt; [
        'contact_id' =&gt; '$value.id',
        'location_type_id' =&gt; 6,
        'phone' =&gt; '(123) 456-7890',
        'is_primary' =&gt; 1,
        'phone_type_id' =&gt; 1,
      ],
      'api.participant.create' =&gt; [
        'contact_id' =&gt; '$value.id',
        'event_id' =&gt; 2,
        'status_id' =&gt; 1,
        'role_id' =&gt; 1,
        'register_date' =&gt; '2007-07-21 00:00:00',
        'source' =&gt; 'Online Event Registration: API Testing',
        'custom_1' =&gt; 'custom string',
      ],
    ];
  $result = civicrm_api3('Contact', 'create', $params);
  </code></pre>
  
  <p>3 - Do you mean to get participant of an event with all contact details in one call ?</p>
  
  <pre><code>   $params = array(
      'contact_id' =&gt; 2,
      'event_id' =&gt; 3,
      'api.contact.get' =&gt; 1,
      'api.email.get' =&gt; ['contact_id' =&gt; '$value.contact_id'],
      'api.address.get' =&gt; ['contact_id' =&gt; '$value.contact_id'],
      'api.phone.get' =&gt; ['contact_id' =&gt; '$value.contact_id'],
    );
  </code></pre>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
  <p>Note: The params build above are not tested, but its the syntax on how one can build params when using chain api.</p>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-03T06:51:27.600Z
Answers.Text: I will try and let you know. Is there any tutorials blogs or youtube  regarding that. Please let me know.
Answers.UserDisplayName: Md Maidul Islam
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T12:22:26.753Z
Answers.LastActivityDate: 2019-04-01T12:22:26.753Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I create an event. I need to create an API for Event Participate(Registration) page. I also retrieve all participates users data via API too. Please let me know .
  I just go API v3 . And see there is Event in Entity fields. I choose it. I choose get .I see there is return form too.I need all participates information . what their address,nationality and some customs fields too. I see there is create function but I don't know how can I add fields.please let know.</p>
  
Tags: <civievent><participants>
Title: CIVICRM Create API for event participate
ThreadText: # CIVICRM Create API for event participate
  
  (Asked by: username_0 on 2019-04-01)
  
  I create an event. I need to create an API for Event Participate(Registration) page. I also retrieve all participates users data via API too. Please let me know .
  I just go API v3 . And see there is Event in Entity fields. I choose it. I choose get .I see there is return form too.I need all participates information . what their address,nationality and some customs fields too. I see there is create function but I don't know how can I add fields.please let know.
  
  **Tags:** civievent, participants
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-01. Score: 2 | Accepted answer
  
  username_0,
  Bit difficult to understand from your question what you want to achieve. 
  1 - Do you mean to add participant for an event? Then you can use Entity = Participant and Action = Create api
  $result = civicrm_api3('Participant', 'create', [
    'event_id' => 3,
    'contact_id' => 51,
  ]);
  
  2 - Do you mean to add participant for an event with all contact details in one call ? Then you can use Entity = Contact and Action = Create chain api
  $params = [
      'display_name' => 'batman',
      'contact_type' => 'Individual',
      'api.address.create' => [
        'contact_id' => '$value.id',
        'location_type_id' => 6,
        'street_name' => 'Ambachtstraat',
        'street_number' => '23',
        'street_address' => 'Ambachtstraat 23',
        'postal_code' => '6971 BN',
        'country_id' => '1152',
        'city' => 'Brummen',
        'is_primary' => 1,
      ],
      'api.email.create' => [
        'contact_id' => '$value.id',
        'location_type_id' => 'Main',
        'email' => 'api@a-team.com',
        'is_primary' => 1,
      ],
      'api.phone.create' => [
        'contact_id' => '$value.id',
        'location_type_id' => 6,
        'phone' => '(123) 456-7890',
        'is_primary' => 1,
        'phone_type_id' => 1,
      ],
      'api.participant.create' => [
        'contact_id' => '$value.id',
        'event_id' => 2,
        'status_id' => 1,
        'role_id' => 1,
        'register_date' => '2007-07-21 00:00:00',
        'source' => 'Online Event Registration: API Testing',
        'custom_1' => 'custom string',
      ],
    ];
  $result = civicrm_api3('Contact', 'create', $params);
  
  3 - Do you mean to get participant of an event with all contact details in one call ?
     $params = array(
      'contact_id' => 2,
      'event_id' => 3,
      'api.contact.get' => 1,
      'api.email.get' => ['contact_id' => '$value.contact_id'],
      'api.address.get' => ['contact_id' => '$value.contact_id'],
      'api.phone.get' => ['contact_id' => '$value.contact_id'],
    );
  
  HTH
  Pradeep
  Note: The params build above are not tested, but its the syntax on how one can build params when using chain api.
  HTH
  Pradeep
  
  > **Comments:**
  > **username_0**: I will try and let you know. Is there any tutorials blogs or youtube  regarding that. Please let me know.  
  
  ---
  
  