Answers.Body: <p>You need to know the custom field ID of the field in question.  If the ID is 14, you can use:</p>
  
  <pre><code>&lt;www_path&gt;?entity=activity&amp;action=create&amp;activity_id=0&amp;target_contact_id=0&amp;custom_14=myvalue
  </code></pre>
  
  <p>In general, if you're asking these sorts of questions, you can answer them best by using the API explorer: <strong>Help menu > Developer > API Explorer</strong>.  You can use it to design your query, and it will build your REST string for you - including looking up custom field IDs.</p>
  
  <p>To get the ID via the GUI, you can go to <strong>Administer menu > Customize Data and Screens > Custom Fields</strong>, then select "View and Edit Custom Fields" for the appropriate group.  If you hover your mouse over the "Edit Field" link, you'll see a URL that ends in "&amp;id=x".  "x" is your field ID.</p>
  
  <p>To get the field ID via the API, do a call to CustomField.get.  Here's a REST call to get the ID of a field called "Mail Designation": </p>
  
  <pre><code>/sites/all/modules/civicrm/extern/rest.php?entity=CustomField&amp;action=get&amp;json={"sequential":1,"label":"Mail Designation"}&amp;api_key=yourkey&amp;key=sitekey
  </code></pre>
  
  <p>Better still, use CustomField.getvalue to return just the ID:</p>
  
  <pre><code>/sites/all/modules/civicrm/extern/rest.php?entity=CustomField&amp;action=getvalue&amp;json={"sequential":1,"return":"id","label":"Mail Designation"}&amp;api_key=yourkey&amp;key=sitekey
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T20:03:30.437Z
Answers.Text: Jon, thanks for the answer and including that resource.  I believe this is what I need.  Cheers!  -matt
Answers.UserDisplayName: mac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T20:27:19.520Z
Answers.Text: Jon - a follow up.  Any clue how to get the ID of a custom field via the api or GUI?  Thanks for the help.
Answers.UserDisplayName: mac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T15:38:44.547Z
Answers.Text: @mcphilly I edited my answer to include your follow-up question.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T20:00:59.073Z
Answers.LastActivityDate: 2015-06-25T15:38:20.770Z
Answers.LastEditDate: 2015-06-25T15:38:20.770Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>How do I set a custom field value for an Activity via the REST API?  </p>
  
  <p>I can create an activity on a contact.  I am looking to set a value for a custom field within that activity as well. </p>
  
  <p>For reference my current POST request looks something like this:</p>
  
  <pre><code>&lt;www_path&gt;?entity=activity&amp;action=create&amp;activity_id=0&amp;target_contact_id=0
  </code></pre>
  
  <p>Any insight is appreciated!  Thanks for the help!</p>
  
Tags: <api><rest>
Title: REST API - setting an activity's custom fields
ThreadText: # REST API - setting an activity's custom fields
  
  (Asked by: username_0 on 2015-06-19)
  
  How do I set a custom field value for an Activity via the REST API?
  
  I can create an activity on a contact. I am looking to set a value for a custom field within that activity as well.
  
  For reference my current POST request looks something like this:
  
  ```
  <www_path>?entity=activity&action=create&activity_id=0&target_contact_id=0
  
  ```
  
  Any insight is appreciated! Thanks for the help!
  
  **Tags:** api, rest
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-19. Score: 3 | Accepted answer
  
  You need to know the custom field ID of the field in question. If the ID is 14, you can use:
  
  ```
  <www_path>?entity=activity&action=create&activity_id=0&target_contact_id=0&custom_14=myvalue
  
  ```
  
  In general, if you're asking these sorts of questions, you can answer them best by using the API explorer: **Help menu > Developer > API Explorer**. You can use it to design your query, and it will build your REST string for you - including looking up custom field IDs.
  
  To get the ID via the GUI, you can go to **Administer menu > Customize Data and Screens > Custom Fields**, then select "View and Edit Custom Fields" for the appropriate group. If you hover your mouse over the "Edit Field" link, you'll see a URL that ends in "&id=x". "x" is your field ID.
  
  To get the field ID via the API, do a call to CustomField.get. Here's a REST call to get the ID of a field called "Mail Designation":
  
  ```
  /sites/all/modules/civicrm/extern/rest.php?entity=CustomField&action=get&json={"sequential":1,"label":"Mail Designation"}&api_key=yourkey&key=sitekey
  
  ```
  
  Better still, use CustomField.getvalue to return just the ID:
  
  ```
  /sites/all/modules/civicrm/extern/rest.php?entity=CustomField&action=getvalue&json={"sequential":1,"return":"id","label":"Mail Designation"}&api_key=yourkey&key=sitekey
  
  ```
  
  > **Comments:**
  > **username_0**: Jon, thanks for the answer and including that resource.  I believe this is what I need.  Cheers!  -matt  
  > **username_0**: Jon - a follow up.  Any clue how to get the ID of a custom field via the api or GUI?  Thanks for the help.  
  > **username_1**: @mcphilly I edited my answer to include your follow-up question.  
  
  ---
  
  