Answers.Body: <p>You're in a bit of a tough spot, I'm afraid.</p>
  <ul>
  <li>The display name is attached to the contact, not the contribution.</li>
  <li>You would typically use an API join to handle this.  However, joining to the Contact entity isn't supported in APIv3.  It <em>is</em> supported in APIv4 (and in fact is one of the main reasons behind API4).</li>
  <li>However, <a href="https://lab.civicrm.org/dev/core/-/issues/1310" rel="nofollow noreferrer">API4 doesn't have a REST interface</a> at present.</li>
  </ul>
  <p>So you have two options:</p>
  <ul>
  <li>Make 2 REST calls;</li>
  <li>Try to use <a href="https://docs.civicrm.org/dev/en/latest/api/v3/chaining/" rel="nofollow noreferrer">APIv3 chaining</a>.  This will let you make a single REST call, but does NOT reduce the number of API calls made internally.  I've always found it to be more trouble than it's worth though, and I shudder to think about what that would look like over REST.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-07T20:43:36.477Z
Answers.Text: Now it is more clear and I finally understand why it doesn't work.
Answers.UserDisplayName: pk825
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-07T20:49:37.370Z
Answers.Text: It is strange that is I choose some fields it give me these, but if I choose a not existing field it give me more fields with the display_name (it is possible to check it also in the api explorer). I trying the chaing mode, but I have to study because I don't know how it works (the documentation is not showing how to pass a variable to the chain)
Answers.UserDisplayName: pk825
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-07T20:08:23.293Z
Answers.LastActivityDate: 2021-01-07T20:08:23.293Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>in my Civicrm 5.31 on Wordpress 5.5 I'm trying to retrieve contribution data via Rest API, using the apiExplorer I get the code:</p>
  <pre><code>wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contribution&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={&quot;sequential&quot;:1,&quot;return&quot;:&quot;contact_id,contribution_source,total_amount,fee_amount,trxn_id,invoice_number&quot;,&quot;receive_date&quot;:{&quot;&gt;&quot;:&quot;01/01/2021&quot;}}
  </code></pre>
  <p>but if I try to add the display_name it doesn't work. I try: contact_id.display_name and display_name</p>
  
Tags: <contacts><api><contributions>
Title: Rest API contribution get doesn't return display_name
ThreadText: # Rest API contribution get doesn't return display_name
  
  (Asked by: username_0 on 2021-01-07)
  
  in my Civicrm 5.31 on Wordpress 5.5 I'm trying to retrieve contribution data via Rest API, using the apiExplorer I get the code:
  
  ```
  wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contribution&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"return":"contact_id,contribution_source,total_amount,fee_amount,trxn_id,invoice_number","receive_date":{">":"01/01/2021"}}
  
  ```
  
  but if I try to add the display\_name it doesn't work. I try: contact\_id.display\_name and display\_name
  
  **Tags:** contacts, api, contributions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-07. Score: 1
  
  You're in a bit of a tough spot, I'm afraid.
  
  * The display name is attached to the contact, not the contribution.
  * You would typically use an API join to handle this. However, joining to the Contact entity isn't supported in APIv3. It *is* supported in APIv4 (and in fact is one of the main reasons behind API4).
  * However, [API4 doesn't have a REST interface](https://lab.civicrm.org/dev/core/-/issues/1310) at present.
  
  So you have two options:
  
  * Make 2 REST calls;
  * Try to use [APIv3 chaining](https://docs.civicrm.org/dev/en/latest/api/v3/chaining/). This will let you make a single REST call, but does NOT reduce the number of API calls made internally. I've always found it to be more trouble than it's worth though, and I shudder to think about what that would look like over REST.
  
  > **Comments:**
  > **username_0**: Now it is more clear and I finally understand why it doesn't work.  
  > **username_0**: It is strange that is I choose some fields it give me these, but if I choose a not existing field it give me more fields with the display_name (it is possible to check it also in the api explorer). I trying the chaing mode, but I have to study because I don't know how it works (the documentation is not showing how to pass a variable to the chain)  
  
  ---
  
  