Answers.Body: <p>The param you are looking for is <code>case_id</code> which can be used like:</p>
  
  <pre><code>civicrm_api3('Activity', 'create', array(
    'subject' =&gt; 'Hello',
    'case_id' =&gt; 123,
    ...
  ));
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T05:02:25.313Z
Answers.Text: This works. Thanks. Where should have I looked for to find that key 'case_id' ?
Answers.UserDisplayName: M Sivani
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T13:26:49.253Z
Answers.Text: @MSivani click the checkbox to mark this answer correct :).
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T13:37:22.817Z
Answers.Text: Hmm you're right that param seems a bit hidden. I think it needs to be added to the `_civicrm_api3_activity_create_spec` function so it will be visible in the api explorer. Here I've [created a PR](https://github.com/civicrm/civicrm-core/pull/5923) to add it.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-27T12:34:20.193Z
Answers.LastActivityDate: 2015-05-27T12:34:20.193Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>you don't have to create an Activity because we already have a table called civicrm_case_activity. Which links the case Id against the new activity created and you can also view the activity against CiviCase Dashboard. I guess this helps!!! </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-27T09:11:46.653Z
Answers.Text: Not sure if you are considering the need that I want to create an Activity using API in my custom module. I do not see any parameter key in civicrm_api('Activity', 'create', $activityparam);  to pass the case id.
Answers.UserDisplayName: M Sivani
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-27T09:54:11.373Z
Answers.Text: yes, you cannot pass case Id while creating the activity but you can create an activity and make a entry in civicrm_case_activity which will link the created activity again the case Id.
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-27T09:03:08.493Z
Answers.LastActivityDate: 2015-05-27T09:03:08.493Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>I want to create an activity inside a case. I can create a case using <code>$result = civicrm_api3('case', 'create', $params);</code> But how do I pass the case id in the api which creates an Activity. To create Activity I am using: <code>civicrm_api('Activity', 'create', $activityparam);</code></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-27T08:52:56.357Z
Comments.Text: Can you edit the question and put the code (including activityparam)
Comments.UserDisplayName: Xavier
Tags: <api>
Title: How to create a case activity using the API?
ThreadText: # How to create a case activity using the API?
  
  (Asked by: username_0 on 2015-05-27)
  
  I want to create an activity inside a case. I can create a case using `$result = civicrm_api3('case', 'create', $params);` But how do I pass the case id in the api which creates an Activity. To create Activity I am using: `civicrm_api('Activity', 'create', $activityparam);`
  
  **Tags:** api
  
  > **Comments:**
  > **username_1**: Can you edit the question and put the code (including activityparam)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-05-27. Score: 5
  
  The param you are looking for is `case_id` which can be used like:
  
  ```
  civicrm_api3('Activity', 'create', array(
    'subject' => 'Hello',
    'case_id' => 123,
    ...
  ));
  
  ```
  
  > **Comments:**
  > **username_0**: This works. Thanks. Where should have I looked for to find that key 'case_id' ?  
  > **username_2**: @username_0 click the checkbox to mark this answer correct :).  
  > **username_2**: Hmm you're right that param seems a bit hidden. I think it needs to be added to the `_civicrm_api3_activity_create_spec` function so it will be visible in the api explorer. Here I've [created a PR](https://github.com/civicrm/civicrm-core/pull/5923) to add it.  
  
  ---
  
  ### Answer by username_3 on 2015-05-27. Score: 1
  
  you don't have to create an Activity because we already have a table called civicrm\_case\_activity. Which links the case Id against the new activity created and you can also view the activity against CiviCase Dashboard. I guess this helps!!!
  
  > **Comments:**
  > **username_0**: Not sure if you are considering the need that I want to create an Activity using API in my custom module. I do not see any parameter key in civicrm_api('Activity', 'create', $activityparam);  to pass the case id.  
  > **username_3**: yes, you cannot pass case Id while creating the activity but you can create an activity and make a entry in civicrm_case_activity which will link the created activity again the case Id.  
  
  ---
  
  