Answers.Body: <p>I don't think you need to chain the calls, you simply need to specify the fields (return custom_xxx) you want to fetch from the membership.</p>
  
  <p>On the API explorer, try to set the return fields you want, and check you can include the custom fields you want</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-04T05:15:56.583Z
Answers.Text: It seems that I can only include custom fields for the main query... in this case membership.  I need custom fields from the chained Contact query.
Answers.UserDisplayName: Rob Brandt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-05T16:33:51.913Z
Answers.Text: That's a limitation of the api explorer, do use it to generate the code on the contact.get and re-use the return param when you call it chained from the membership and it will work
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-03T07:20:41.677Z
Answers.LastActivityDate: 2017-07-03T07:20:41.677Z
Answers.UserDisplayName: Xavier
Body: <p>I am trying to use the API to get membership data, including some custom fields.  I have the general idea, I think.  I can successfully retrieve the memberships, chained in the contact data, and now I need to include some data in custom fields.  The table the custom data is stored in is called "college_data_1" and one of the custom fields is called "enrollment_3".  So I believe I want entity 1 and field 3. I didn't find documentation that confirms how to find these IDs.  So what I current have in API explorer is:</p>
  
  <p>rest.php?entity=Membership&amp;action=get&amp;api_key=userkey&amp;key=sitekey&amp;json={"sequential":1,"membership_type_id":"Membership Name","api.Contact.get":{},"api.CustomValue.get":{"id":3,"entity_id":1}}</p>
  
  <p>however this doesn't work.  Help?</p>
  
  <p>I will need to include website data too, next.</p>
  
Tags: <civimember><custom-fields><api>
Title: Getting Custom field values via API using chaining
ThreadText: # Getting Custom field values via API using chaining
  
  (Asked by: username_0 on 2017-07-02)
  
  I am trying to use the API to get membership data, including some custom fields. I have the general idea, I think. I can successfully retrieve the memberships, chained in the contact data, and now I need to include some data in custom fields. The table the custom data is stored in is called "college\_data\_1" and one of the custom fields is called "enrollment\_3". So I believe I want entity 1 and field 3. I didn't find documentation that confirms how to find these IDs. So what I current have in API explorer is:
  
  rest.php?entity=Membership&action=get&api\_key=userkey&key=sitekey&json={"sequential":1,"membership\_type\_id":"Membership Name","api.Contact.get":{},"api.CustomValue.get":{"id":3,"entity\_id":1}}
  
  however this doesn't work. Help?
  
  I will need to include website data too, next.
  
  **Tags:** civimember, custom-fields, api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-03. Score: 2
  
  I don't think you need to chain the calls, you simply need to specify the fields (return custom\_xxx) you want to fetch from the membership.
  
  On the API explorer, try to set the return fields you want, and check you can include the custom fields you want
  
  > **Comments:**
  > **username_0**: It seems that I can only include custom fields for the main query... in this case membership.  I need custom fields from the chained Contact query.  
  > **username_1**: That's a limitation of the api explorer, do use it to generate the code on the contact.get and re-use the return param when you call it chained from the membership and it will work  
  
  ---
  
  