Answers.Body: <p>Have you looked at creating a module extension and using hook_civicrm_summary<br>
  <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/</a></p>
  
  <p>Module creation is described here <a href="https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-module" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-module</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-22T12:06:37.207Z
Answers.LastActivityDate: 2018-11-22T12:06:37.207Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>Try the <a href="https://github.com/civicrm/org.civicrm.contactlayout" rel="nofollow noreferrer">Contact Summary Layout Editor</a> that lets you restructure the contact summary.  There are a couple of other extensions that link with it that can provide blocks - see the readme.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-22T11:51:29.400Z
Answers.Text: I don't really need to restructure the layout as such, it would more be something like the linked [relationship block](https://github.com/eileenmcnaughton/org.wikimedia.relationshipblock) extension - am i right in thinking that it will be doing its API call(s) alongside the rest of the load, so will be faster in that regard?
Answers.UserDisplayName: user3016811
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-22T16:48:15.823Z
Answers.Text: It would be querying the data serverside and delivering it as part of the page.  There is probably less lag from when the page starts to display to when your JS has loaded, but at the expense of more time building the page before it gets sent to the browser.  But there is increasing use of AJAX - pulling data via javascript is a popular approach.  Optimising the api calls (only returning what you actually need) might speed things up for you.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-22T10:50:15.443Z
Answers.LastActivityDate: 2018-11-22T10:50:15.443Z
Answers.UserDisplayName: Aidan
Body: <p>I pull out some important at-a-glance information on contact summary pages - membership info, relationships via related cases, etc.</p>
  
  <p>At the moment i override contentsummary.tpl and do my API calls with javascript - page loads, my things fire, then for some, returned values are used in a second API call.</p>
  
  <p>This is slow and feels embarrassingly cludgy! </p>
  
  <p>What <em>should</em> i be using for this? </p>
  
Tags: <api><javascript>
Title: Correct method for API calls on contact summary page? (slow!)
ThreadText: # Correct method for API calls on contact summary page? (slow!)
  
  (Asked by: username_0 on 2018-11-22)
  
  I pull out some important at-a-glance information on contact summary pages - membership info, relationships via related cases, etc.
  
  At the moment i override contentsummary.tpl and do my API calls with javascript - page loads, my things fire, then for some, returned values are used in a second API call.
  
  This is slow and feels embarrassingly cludgy!
  
  What *should* i be using for this?
  
  **Tags:** api, javascript
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-11-22. Score: 1
  
  Have you looked at creating a module extension and using hook\_civicrm\_summary  
  <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/>
  
  Module creation is described here <https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-module>
  
  
  ---
  
  ### Answer by username_2 on 2018-11-22. Score: 1
  
  Try the [Contact Summary Layout Editor](https://github.com/civicrm/org.civicrm.contactlayout) that lets you restructure the contact summary. There are a couple of other extensions that link with it that can provide blocks - see the readme.
  
  > **Comments:**
  > **username_0**: I don't really need to restructure the layout as such, it would more be something like the linked [relationship block](https://github.com/eileenmcnaughton/org.wikimedia.relationshipblock) extension - am i right in thinking that it will be doing its API call(s) alongside the rest of the load, so will be faster in that regard?  
  > **username_2**: It would be querying the data serverside and delivering it as part of the page.  There is probably less lag from when the page starts to display to when your JS has loaded, but at the expense of more time building the page before it gets sent to the browser.  But there is increasing use of AJAX - pulling data via javascript is a popular approach.  Optimising the api calls (only returning what you actually need) might speed things up for you.  
  
  ---
  
  