Answers.Body: <p>The best way to learn how to use the API is the Api Explorer which is built into CiviCRM (find it in the <strong>Support -&gt; Developer</strong> menu. It will write the following code for you:</p>
  <pre><code>$optionValues = \Civi\Api4\OptionValue::get(TRUE)
    -&gt;addWhere('option_group_id:name', '=', 'payment_instrument')
    -&gt;addWhere('is_active', '=', TRUE)
    -&gt;execute();
  foreach ($optionValues as $optionValue) {
    // do something
  }
  </code></pre>
  <p>With this GUI:</p>
  <p><a href="https://i.sstatic.net/FYQDJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FYQDJ.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-06T01:05:51.233Z
Answers.Text: I have used the API Explorer 4 but could not reach the options within a sub entity of an entity. Is there really no way to get that data out?
Answers.UserDisplayName: James
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-06T01:13:20.970Z
Answers.Text: https://pastebin.com/QYyR40ZR Here is my return message and there are options under payment_instrument that i would like to view
Answers.UserDisplayName: James
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-06T10:22:34.687Z
Answers.Text: You will need to use Option value as the entity to fetch the options
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-05T09:42:18.350Z
Answers.LastActivityDate: 2023-09-05T12:45:31.507Z
Answers.LastEditDate: 2023-09-05T12:45:31.507Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>get all options from a sub entity named payment_instrument within a entity called OptionGroup</p>
  
Tags: <api><civicrm-entity><apiv4><fieldoptions>
Title: Api get all option within sub entity
ThreadText: # Api get all option within sub entity
  
  (Asked by: username_0 on 2023-09-05)
  
  get all options from a sub entity named payment\_instrument within a entity called OptionGroup
  
  **Tags:** api, civicrm-entity, apiv4, fieldoptions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-09-05. Score: 2
  
  The best way to learn how to use the API is the Api Explorer which is built into CiviCRM (find it in the Support -> Developer menu. It will write the following code for you:
  $optionValues = \Civi\Api4\OptionValue::get(TRUE)
    ->addWhere('option_group_id:name', '=', 'payment_instrument')
    ->addWhere('is_active', '=', TRUE)
    ->execute();
  foreach ($optionValues as $optionValue) {
    // do something
  }
  
  With this GUI:
  
  > **Comments:**
  > **username_0**: I have used the API Explorer 4 but could not reach the options within a sub entity of an entity. Is there really no way to get that data out?  
  > **username_0**: https://pastebin.com/QYyR40ZR Here is my return message and there are options under payment_instrument that i would like to view  
  > **username_1**: You will need to use Option value as the entity to fetch the options  
  
  ---
  
  