Answers.Body: <p>If include 'state_province' in return param it should return you state_province_id, state_province_name and state_province.</p>
  <p>For geofield1 you need to use 'geo_code_1'.</p>
  <p>If you search for primary address in return field drop down under api explorer you should see the exact name for fields to retrieve for address.</p>
  <pre><code>$result = civicrm_api3('Contact', 'get', [
    'sequential' =&gt; 1,
    'return' =&gt; [&quot;address_id&quot;, &quot;city&quot;, &quot;postal_code&quot;, &quot;state_province&quot;, &quot;geo_code_1&quot;, &quot;country&quot;],
    'state_province_name' =&gt; ['IS NOT NULL' =&gt; 1],
  ]);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T21:34:30.080Z
Answers.Text: I also realised is quicker to use the address entity and do a join to the contact data.
Answers.UserDisplayName: Tony Horrocks
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T20:10:08.310Z
Answers.LastActivityDate: 2021-03-31T20:10:08.310Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>If I do a api3 contact 'get' with no return fields specified, it obvs returns all the fields including address fields.</p>
  <p>What I want to do is only retrieve certain fields for my needs, just to reduce overhead.</p>
  <p>If  I specify to return only 'state_province_name' or 'geofield1', they are not returned.</p>
  <p>Is there a way to do this in a single call?</p>
  
Tags: <api>
Title: Specified return fields in contact get do not get returned
ThreadText: # Specified return fields in contact get do not get returned
  
  (Asked by: username_0 on 2021-03-31)
  
  If I do a api3 contact 'get' with no return fields specified, it obvs returns all the fields including address fields.
  
  What I want to do is only retrieve certain fields for my needs, just to reduce overhead.
  
  If I specify to return only 'state\_province\_name' or 'geofield1', they are not returned.
  
  Is there a way to do this in a single call?
  
  **Tags:** api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-31. Score: 1
  
  If include 'state_province' in return param it should return you state_province_id, state_province_name and state_province.
  For geofield1 you need to use 'geo_code_1'.
  If you search for primary address in return field drop down under api explorer you should see the exact name for fields to retrieve for address.
  $result = civicrm_api3('Contact', 'get', [
    'sequential' => 1,
    'return' => ["address_id", "city", "postal_code", "state_province", "geo_code_1", "country"],
    'state_province_name' => ['IS NOT NULL' => 1],
  ]);
  
  > **Comments:**
  > **username_0**: I also realised is quicker to use the address entity and do a join to the contact data.  
  
  ---
  
  