Cant getLead when task is assigned
Closed this issue · 34 comments
any close.io lead with a task pulls this error back in php
Fatal error: Uncaught exception 'LooplineSystems\CloseIoApiWrapper\Library\Exception\UndefinedMethodException' with message 'Method: setType does not exist' in /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php:47
Stack trace:
#0 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Model/Task.php(100): LooplineSystems\CloseIoApiWrapper\Model\Task->hydrate(Array, Array, Array)
#1 [internal function]: LooplineSystems\CloseIoApiWrapper\Model\Task->__construct(Array)
#2 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php(63): ReflectionClass->newInstanceArgs(Array)
#3 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/Cl in /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php on line 47
so i cant call that lead until i trash the task on it
@phillypro - thx for you report, i am gonna check on it.
as we need to finish a release till the end of the today, it might take until next week before i can actually fix it. But if it´s a quick one i´ll try provide you a fix as soon as possible.
@phillypro after checking it turned out that a new field on the task entity was added.
the field is called "_type", not sure why they used the underscore at the beginning but thats not a problem when hydrating, we
ll remove the underscores anyway.
only when trying to set the field we will need to map that, but i checked the official api documentation which says for "POST /task/" that the field type atm always defaults to "lead", so you will get the new field with a GET request but not be able to set ist when creating new tasks.
Currently adding the field. new version will be ready in a few hours latest
@phillypro a new version "v0.3.1" has just been released covering your issue.
I will leave the issue open, it would be nice if you could use the new version and close the issue on success.
Hey im up and cool looking forward to it
On Apr 15, 2016 4:27 AM, "Marco Roßdeutscher" notifications@github.com
wrote:
@phillypro https://github.com/phillypro a new version v0.3.1has just
been released covering your issue.I will leave the issues open, it would be nice if you could use the new
version and close the issue on success.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
@phillypro Hey Phill - have you been able to test the lastest version so either you or we can close the issue?
greets null9beta
i tested it....still not working :(
i updated the files with your new download package
soon as i add a task...its an instant error
another thing i noticed is you changed searchLeads to findLeads in the
LeadApi.php
i had some text messaging tied into that and i guess it broke with the
update lol
i was trying to get it back working again but i see it works a little
differently now
before i used to be able to search a phone number and return a lead like
this
$closeIoApiWrapper = new CloseIoApiWrapper($closeIoConfig);
$leadsApi = $closeIoApiWrapper->getLeadApi();
$s = $leadsApi->searchLeads($phone);
if ($s) {
$s = $s[0];
return $s->getName();
} else {
return 'Unknown';
}
now i get an error about an array when i switch searchLeads to your new
function findLeads
On Mon, Apr 18, 2016 at 3:52 AM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro Hey Phill - have you been able
to test the lastest version so either you or we can close the issue?greets null9beta
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
Hi phillypro
the findLeads requires an array like
['email_address' => '...']
soon as i add a task...its an instant error
So you are trying to create a Lead and add a task before creating the Lead?
Can you explain or give me a code sample what you are calling. That would help me identify what´s going on.
any close.io lead with a task pulls this error back in php
so i cant call that lead until i trash the task on it
Maybe i misunderstood your first inquiry.
I though you are getting that error when you try to GET a Lead that has a task.
As described in my previous comment, there should be no problem omitting the task type when you create tasks.
#15 (comment)
There is 2 questions still i can not really figure out
- The close.io developer documentation says
Create a new lead. Contacts, addresses, and custom fields can all be nested in the lead. Currently, activities, tasks, and opportunities must be posted separately.
So during the Lead creation you cannot add tasks.
To add a task you would need to use the Tasks Endpoints. But we did not add the TaskApi so far.
So how do you get that error when trying to create a task? Or maybe again i did not completely understood. A code sample would really help.
Maybe it fails because you are trying to add a task when creating the lead!?
- You said we changed searchLeads to findLeads, i am not sure about that, i checked the full history and could only see that we added findLeads, are you sure that was our code?
We are really willing to help you out, that`s why it would be perfect to clarify the questions first and maybe see a code sample of the thing that fails (i think i wrote that the 3rd time now, lol)
cheers null9beta
@phillypro after discussing with a colleague i think i know what you are doing.
Guess
- you are reading a lead from the api which will fill up the Lead Object on our side, right?
- then you are updating some fields, probably
- and finally want to update the lead then
Just a guess but maybe right?
Problem
The problem is that the close.io API Requests and Reponses are slightly different for the same endpoints.
That means the GET:/leads will return way more information/properties about a Lead then allowed to be used inside the POST or PUT/PATCH methods.
If a Lead that you loaded, or filled up yourself, now e.g. contains tasks it will fail on the close.io side.
Is this somehow what happens to you?
This also would explain why you need/can drop the tasks and it will work.
Solution
Will think about a way to prevent sending properties that are not appropriate for sending. Basically this is an API design issues, but we`ll find a way around that, for sure.
hmmn my mistake my friend charles added searchLead and you have findleads
what would be the proper syntax to search a phone number using findlead?
my brain is dumb today
ps. and yea for tasks in closeio the tasks were created on closeio website
interface...but would fail when any lead with a task is retreived via the
php wrapper
On Tue, Apr 19, 2016 at 6:39 AM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro after discussing with a
colleague i think i know what you are doing.Guess
- you are reading a lead from the api which will fill up the Lead Object
on our side, right?- then you are updating some fields, probably
- and finally want to update the lead then
Just a guess but maybe right?
Problem
The problem is that the close.io API Requests and Reponses are slightly
different for the same endpoints.That means the GET:/leads will return way more information/properties
about a Lead then allowed to be used inside the POST or PUT/PATCH methods.If a Lead that you loaded, or filled up yourself, now e.g. contains tasks
it will fail on the close.io side.Is this somehow what happens to you?
This also would explain why you need/can drop the tasks and it will work.Solution
Will think about a way to prevent sending properties that are not
appropriate for sending. Basically this is an API design issues, but we`ll
find a way around that, for sure.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
nvm i got it worked out on my end for findLeads....
jus wrote my own function there .....but yea keep me posted on the tasks
issue :)
On Tue, Apr 19, 2016 at 5:29 PM, philly daboss phillymantis@gmail.com
wrote:
hmmn my mistake my friend charles added searchLead and you have findleads
what would be the proper syntax to search a phone number using findlead?
my brain is dumb todayps. and yea for tasks in closeio the tasks were created on closeio website
interface...but would fail when any lead with a task is retreived via the
php wrapperOn Tue, Apr 19, 2016 at 6:39 AM, Marco Roßdeutscher <
notifications@github.com> wrote:@phillypro https://github.com/phillypro after discussing with a
colleague i think i know what you are doing.Guess
- you are reading a lead from the api which will fill up the Lead Object
on our side, right?- then you are updating some fields, probably
- and finally want to update the lead then
Just a guess but maybe right?
Problem
The problem is that the close.io API Requests and Reponses are slightly
different for the same endpoints.That means the GET:/leads will return way more information/properties
about a Lead then allowed to be used inside the POST or PUT/PATCH methods.If a Lead that you loaded, or filled up yourself, now e.g. contains tasks
it will fail on the close.io side.Is this somehow what happens to you?
This also would explain why you need/can drop the tasks and it will work.Solution
Will think about a way to prevent sending properties that are not
appropriate for sending. Basically this is an API design issues, but we`ll
find a way around that, for sure.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
@phillypro alright.
Please see my @marczahnlls comment little above about how to use the findLeads() method
#15 (comment)
ps. and yea for tasks in closeio the tasks were created on closeio website
interface...but would fail when any lead with a task is retreived via the
php wrapper
So the problem is on the GET request, yes?
Because the GET request is covered by a test and working fine for me. I also tested against a close.io instance.
See this test.
https://github.com/loopline-systems/closeio-api-wrapper/blob/develop/tests/LooplineSystems/CloseIoApi/Api/LeadTest.php#L144
So if you get the error on the GET Request i need to ask if you are sure you updated composer, aka updated the package to version v0.3.1
{
"require": {
"loopline-systems/closeio-api-wrapper": "0.3.1"
}
}
Which of those 2 methods are u using? Maybe again the reponse is slightly different, and thight might cause the error.
getAllLeads
https://github.com/loopline-systems/closeio-api-wrapper/blob/v0.3.1/src/LooplineSystems/CloseIoApiWrapper/Api/LeadApi.php#L41
On the other hand, the POST and PUT for a lead (the create and update) will currently fail if there is task involved. That`s true, and we are fixing it asap.
@phillypro ok after some more investigation it turns out that also other close.io entities changed there properties. That means hydrating the objects will fail on certain sub-entites.
e.g. Opportunities have changed.
So i guess the error message you get should have changed from "method setType not found" into e.g. "method setDate not found".
-> this is a new field date in the opportunity entity.
We´ll a) just add the new ones + try to contact close.io asking if there is any chance of versioning the api or at least something like a notice page about those changes.
Fix with the missing fields incoming.
@phillypro
If you want to use the findLeads method to search for a lead just use
['phone' => '...']
we just released a new version 0.3.2
@see https://packagist.org/packages/loopline-systems/closeio-api-wrapper
This version adds the new fields also in the other entities and should fix your problem.
Also check the last comment about the usage of the findLeads method.
Same request from my side, it would be great if you could test the new version and close the issue if everything is fine now. have a nice day
cheers
null9beta
i currently load in
$activitiesApi = $closeIoApiWrapper->getActivitiesApi();
to send an email $activitiesApi->addEmailActivity($emailActivity);
i see you've since removed loading activitiesApi in your new release...what
should i be doing instead with my emailActivity object?
On Thu, Apr 21, 2016 at 12:02 PM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro
we just released a new version 0.3.2
@see https://github.com/see
https://packagist.org/packages/loopline-systems/closeio-api-wrapperThis version adds the new fields also in the other entities and should fix
your problem.
Also check the last comment about the usage of the findLeads method.Same request from my side, it would be great if you could test the new
version and close the issue if everything is fine now. have a nice daycheers
null9beta—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
trying to make sure i stay compatible with you since these autoload updates
will wreak havoc if i dont lol :)
On Thu, Apr 21, 2016 at 12:02 PM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro
we just released a new version 0.3.2
@see https://github.com/see
https://packagist.org/packages/loopline-systems/closeio-api-wrapperThis version adds the new fields also in the other entities and should fix
your problem.
Also check the last comment about the usage of the findLeads method.Same request from my side, it would be great if you could test the new
version and close the issue if everything is fine now. have a nice daycheers
null9beta—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
@phillypro - the ActivitiesAPI of close.io has not yet been added by us.
So i assume it might be related to a different library or custom code !?
It would be great if we could validate that the changes we made in that issue are applying and close this one. The only changes we made include adding new properties that where added by close.io.
And btw. you are absolutely welcome to add new parts of the close.io api here with a pull request, e.g. the ActivitiesAPI.
cheers
null9beta
yea add this to the project....ActivitiesAPI when included...you can send
emails and the like
$response = $activitiesApi->addEmailActivity($emailActivity);
On Tue, Apr 26, 2016 at 12:59 PM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro - the ActivitiesAPI of close.io
has not yet been added by us.
So i assume it might be related to a different library or custom code !?It would be great if we could validate that the changes we made in that
issues are applying and close this one. The only changes we made include
adding new properties that where added by close.io.And btw. you are absolutely welcome to add new parts of the close.io api
here with a pull request, e.g. the ActivitiesAPI.cheers
null9beta—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
hey marco something mightve changed but as of the lat 5 days
the getLead function produces this error
Fatal error: Uncaught
LooplineSystems\CloseIoApiWrapper\Library\Exception\JsonDecodingException:
JSON syntax is malformed in
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/CloseIoRequest.php:66
Stack trace: #0
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/Api/AbstractApi.php(169):
LooplineSystems\CloseIoApiWrapper\CloseIoRequest->setData(NULL) #1
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Api/LeadApi.php(66):
LooplineSystems\CloseIoApiWrapper\Library\Api\AbstractApi->prepareRequest('get-lead',
NULL, Array) #2
/digitalbrandz/wp-content/themes/twentyfifteen/test.php(38):
LooplineSystems\CloseIoApiWrapper\Api\LeadApi->getLead('lead_R3Iu6nv5h3...')
#3 /wordpress/core/4.5.2/wp-includes/template-loader.php(75): includ in
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/CloseIoRequest.php
on
line 66
ive tried it with different lead ids and by itself on a test php
page...same results....is this happening for you as well?
On Tue, Apr 26, 2016 at 12:59 PM, Marco Roßdeutscher <
notifications@github.com> wrote:
@phillypro https://github.com/phillypro - the ActivitiesAPI of close.io
has not yet been added by us.
So i assume it might be related to a different library or custom code !?It would be great if we could validate that the changes we made in that
issues are applying and close this one. The only changes we made include
adding new properties that where added by close.io.And btw. you are absolutely welcome to add new parts of the close.io api
here with a pull request, e.g. the ActivitiesAPI.cheers
null9beta—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
Hi @phillypro
The problem is your null. setData expects either a json string or an object respectively an array. If you provide a string, json_decode is used to validate it.
Since json_decode cannot handle null it fails in your case. To avoid this problem you could either check for null or you provide an empty object resp. array.
Hope that helps.
Update: What is your expectation when you provide null? Do you want to send null explicitly? Or do you want to remove the field from the sent data?
man im so confused Marc :(
so basically i tried to run a basic line
$leadsApi->getLead('lead_F5uMQLda8NL2sCaq5HWApPWFOLT1igWFlDYPxH6zaF1');
and i get the error
where am i providing null in this situation?...thats whats confusing me
On Thu, May 19, 2016 at 4:02 AM, Marc Zahn notifications@github.com wrote:
Update: What is your expectation when you provide null? Do you want to
send null explicitly? Or do you want to remove the field from the sent data?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
maybe we can hop on a screenshare so you can see what ive accomplished :)
On Thu, May 19, 2016 at 4:02 AM, Marc Zahn notifications@github.com wrote:
Update: What is your expectation when you provide null? Do you want to
send null explicitly? Or do you want to remove the field from the sent data?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
Hi phillypro,
unfortunately we are pretty short on time so I am afraid we need to delay the screen share.
These are two different things. What is the error on the getLead call?
You can see the call of setData with null in the stack trace you posted:
LooplineSystems\CloseIoApiWrapper\CloseIoRequest->setData(NULL)
hey my man this is my exact call on a test page with nothing but this call
use LooplineSystems\CloseIoApiWrapper\CloseIoConfig;
use LooplineSystems\CloseIoApiWrapper\CloseIoApiWrapper;
use LooplineSystems\CloseIoApiWrapper\Model;
use LooplineSystems\CloseIoApiWrapper\Model\Lead;
use LooplineSystems\CloseIoApiWrapper\Model\Address;
use LooplineSystems\CloseIoApiWrapper\Model\Contact;
use LooplineSystems\CloseIoApiWrapper\Model\Email;
use LooplineSystems\CloseIoApiWrapper\Model\Phone;
use LooplineSystems\CloseIoApiWrapper\Tests;
use LooplineSystems\CloseIoApiWrapper\Model\EmailActivity;
?>
i get this error in return
Fatal error: Uncaught
LooplineSystems\CloseIoApiWrapper\Library\Exception\JsonDecodingException:
JSON syntax is malformed in
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/CloseIoRequest.php:66
Stack trace: #0
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/Api/AbstractApi.php(169):
LooplineSystems\CloseIoApiWrapper\CloseIoRequest->setData(NULL) #1
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Api/LeadApi.php(111):
LooplineSystems\CloseIoApiWrapper\Library\Api\AbstractApi->prepareRequest('get-lead',
NULL, Array) #2
/digitalbrandz/wp-content/themes/twentyfifteen/test.php(38):
LooplineSystems\CloseIoApiWrapper\Api\LeadApi->getLead('TestId') #3
/wordpress/core/4.5.2/wp-includes/template-loader.php(75):
include('/digital in
/digitalbrandz/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/CloseIoRequest.php
on
line 66
On Fri, May 20, 2016 at 3:36 AM, Marc Zahn notifications@github.com wrote:
Hi phillypro,
unfortunately we are pretty short on time so I am afraid we need to delay
the screen share.These are two different things. What is the error on the getLead call?
You can see the call of setData with null in the stack trace you posted:
LooplineSystems\CloseIoApiWrapper\CloseIoRequest->setData(NULL)
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
crazy thing is everything used to work perfectly this just started
happening in the last 2 days
On Fri, May 20, 2016 at 3:36 AM, Marc Zahn notifications@github.com wrote:
Hi phillypro,
unfortunately we are pretty short on time so I am afraid we need to delay
the screen share.These are two different things. What is the error on the getLead call?
You can see the call of setData with null in the stack trace you posted:
LooplineSystems\CloseIoApiWrapper\CloseIoRequest->setData(NULL)
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
Hi,
it's not your faul at all. We just found an error in the getLead method which is already fixed but needs to be tested.
Regards
Marc
Thanks bro...you guys are awesome...im yaour tester when needed
On May 20, 2016 10:47 AM, "Marc Zahn" notifications@github.com wrote:
Hi,
it's not your faul at all. We just found an error in the getLead method
which is already fixed but needs to be tested.Regards
Marc—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
let me know if you need a tester
On Fri, May 20, 2016 at 10:47 AM, Marc Zahn notifications@github.com
wrote:
Hi,
it's not your faul at all. We just found an error in the getLead method
which is already fixed but needs to be tested.Regards
Marc—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15 (comment)
Hi @phillypro,
We improved the handling of submitted data in the new release: https://github.com/loopline-systems/closeio-api-wrapper/releases/tag/v0.3.3
@phillypro - it would be great if you could validate the release.
Also it would be great if we could close this particular ticket, `cause it is getting really large already. If there is any new things popping up, can you please create a new ticket.
i will still keep this one open and wait for your response, so if the current state works, feel free to close the ticket.
cheers
null9beta
@phillypro i am closing this ticket now, if you need anymore just give us a ping