-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Metrics from 2 or more projects #24
Comments
@papazetis This is a good question! By default, the library uses a shared client which is what received the API key during the $customer_client = \Delighted\Client::getInstance(['apiKey' => 'project_1_api_key']);
$customer_metrics = \Delighted\Metrics::retrieve([], $customer_client);
$partner_client = \Delighted\Client::getInstance(['apiKey' => 'project_2_api_key']);
$partner_metrics = \Delighted\Metrics::retrieve([], $partner_client); The trick is to pass the client that you manually create as the last argument when calling the relevant API method. It's a bit cumbersome, since you need to pass in the arguments before the last one -- to see the exact arguments needed I would scope the source code https://github.com/delighted/delighted-php/tree/master/lib/Delighted Hope this helps, let me know if you have any questions. |
@mkdynamic I tried that trick but it didn't work. |
Ah, sounds like a bug, sorry! Looking into this... |
I am trying to get the metrics from 2 projects with following code:
Delighted\Client::setApiKey('project_1_api_key');
$customer_metrics = \Delighted\Metrics::retrieve();
Delighted\Client::setApiKey('project_2_api_key');
$partner_metrics = \Delighted\Metrics::retrieve();
But
$partner_metrics
always has the value from 1st project.I think that second connection never happens.
The text was updated successfully, but these errors were encountered: