WHMCS / developer-docs

Developer documentation portal content
72 stars 114 forks source link

Update example for Usage Metrics, fix incorrect use of username which should be domain, add simulated API call example, add code comments #296

Open agileware-justin opened 3 months ago

agileware-justin commented 3 months ago

Was struggling to get the Usage Metrics working correctly when called by WHMCS cron, it turns out that the example code was incorrect.

This PR updates the example code for Usage Metrics.

  1. Fixes incorrect use of username which should be domain for the usage function
  2. Adds simulated API call example code
  3. Adds some code comments
agileware-justin commented 3 months ago

Found this related discussion which is relevant to these changes, https://whmcs.community/topic/297347-usage-metrics-not-updating/

agileware-justin commented 3 months ago

And also this feature request, https://requests.whmcs.com/idea/make-field-to-use-for-tenantusage-configurable

agileware-justin commented 3 months ago

I realise now too that this PR's apiCall example is still incorrect and should be improved. I'll do that too.