Answers.Body: <p>Have a look at <a href="https://github.com/civicrm/civicrm-core/blob/master/api/v3/Generic.php#L57" rel="nofollow noreferrer">api/v3/Generic.php's</a> civicrm_api3_generic_getfields method</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-30T11:47:29.033Z
Answers.LastActivityDate: 2017-01-02T19:18:50.817Z
Answers.LastEditDate: 2017-01-02T19:18:50.817Z
Answers.UserDisplayName: nielo
Body: <p>I have a working extension with a working API hook <code>civicrm_api3_contact_getclif($params)</code>, but I can't find the documentation for the <code>_spec</code> function beyond <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/How+to+migrate+or+write+an+api" rel="nofollow noreferrer">the suggestion to have one</a></p>
  
  <p>I wrote this function and it appears to work (ie the params are appearing in the API explorer as required), but I suspect there is more to this function.</p>
  
  <p>What else can I include in this function to provide more metadata about the API I am writing?</p>
  
  <p><code>
  function _civicrm_api3_contact_getclif_spec(&amp;$spec) { 
    $spec['clif']['api.required'] = 1;<br>
    $spec['length']['api.required'] = 1;<br>
  }
  </code></p>
  
  <p>Can anyone point me to the source file that calls the <code>*_spec()</code> function if there is no doco?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-27T22:10:54.090Z
Comments.Text: I don't understand your question. What do you mean by "hook"? And you can read the _spec but you cannot read the api method itself? In general the_spec method only describes the available params and the method named similarily w/o the _spec param does the work. Read it and there you go. And by the way, an "offset" param shouldn't exist, it's covered in the obligatory 'options' param...
Comments.UserDisplayName: nielo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-28T00:22:33.913Z
Comments.Text: oh right maybe it's not a hook per se, more some kind of meta-data supplier... thanks for the pointer on the offset - but I'm still having trouble finding the doco that summarises the functionality.. any clues
Comments.UserDisplayName: ErichBSchulz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-28T00:30:28.247Z
Comments.Text: have edited the question to clarify. Thanks @nielo
Comments.UserDisplayName: ErichBSchulz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-29T22:14:14.090Z
Comments.Text: Sorry dude, I just can't see any clarification. Reading your updated question I would answer: No, there isn't more to this function. And there is no core source file holding such methods. What about a 'grep -r civicrm_api3_contact_getclif <your extensions source>'?
Comments.UserDisplayName: nielo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-29T23:05:36.753Z
Comments.Text: sorry I'm not being clear. `_civicrm_api3_contact_getclif_spec` is a function I wrote and it is working - but the thing is I have no clue as to what else I can include in the function to provide better metadata on the API I am writing.
Comments.UserDisplayName: ErichBSchulz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-29T23:09:29.853Z
Comments.Text: just edited my question again @nielo to (hopefully) clarify - many thanks for your efforts!
Comments.UserDisplayName: ErichBSchulz
Tags: <api><extension><hooks>
Title: Documentation on the _civicrm_api3_* _spec functions
ThreadText: # Documentation on the _civicrm_api3_* _spec functions
  
  (Asked by: username_0 on 2016-12-27)
  
  I have a working extension with a working API hook `civicrm_api3_contact_getclif($params)`, but I can't find the documentation for the `_spec` function beyond [the suggestion to have one](https://wiki.civicrm.org/confluence/display/CRMDOC/How+to+migrate+or+write+an+api)
  
  I wrote this function and it appears to work (ie the params are appearing in the API explorer as required), but I suspect there is more to this function.
  
  What else can I include in this function to provide more metadata about the API I am writing?
  
  `function _civicrm_api3_contact_getclif_spec(&$spec) {
  $spec['clif']['api.required'] = 1;  
  $spec['length']['api.required'] = 1;  
  }`
  
  Can anyone point me to the source file that calls the `*_spec()` function if there is no doco?
  
  **Tags:** api, extension, hooks
  
  > **Comments:**
  > **username_1**: I don't understand your question. What do you mean by "hook"? And you can read the _spec but you cannot read the api method itself? In general the_spec method only describes the available params and the method named similarily w/o the _spec param does the work. Read it and there you go. And by the way, an "offset" param shouldn't exist, it's covered in the obligatory 'options' param...  
  > **username_0**: oh right maybe it's not a hook per se, more some kind of meta-data supplier... thanks for the pointer on the offset - but I'm still having trouble finding the doco that summarises the functionality.. any clues  
  > **username_0**: have edited the question to clarify. Thanks @username_1  
  > **username_1**: Sorry dude, I just can't see any clarification. Reading your updated question I would answer: No, there isn't more to this function. And there is no core source file holding such methods. What about a 'grep -r civicrm_api3_contact_getclif <your extensions source>'?  
  > **username_0**: sorry I'm not being clear. `_civicrm_api3_contact_getclif_spec` is a function I wrote and it is working - but the thing is I have no clue as to what else I can include in the function to provide better metadata on the API I am writing.  
  > **username_0**: just edited my question again @username_1 to (hopefully) clarify - many thanks for your efforts!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-30. Score: 2 | Accepted answer
  
  Have a look at [api/v3/Generic.php's](https://github.com/civicrm/civicrm-core/blob/master/api/v3/Generic.php#L57) civicrm\_api3\_generic\_getfields method
  
  
  ---
  
  