3

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

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?

  • 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... – nielo Dec 27 '16 at 22:10
  • 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 – ErichBSchulz Dec 28 '16 at 0:22
  • have edited the question to clarify. Thanks @nielo – ErichBSchulz Dec 28 '16 at 0:30
  • 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>'? – nielo Dec 29 '16 at 22:14
  • 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. – ErichBSchulz Dec 29 '16 at 23:05
2

Have a look at api/v3/Generic.php's civicrm_api3_generic_getfields method

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.