Hello guys I’m trying to apply tags to a contact . I’m using xmlrpc tag function addToGroup
function to apply tag but the problem is it keeps on throwing me this error
fXmlRpc\Exception\FaultException: [DatabaseError]Error loading contact in
Can somebody tell me what is it that I’m doing wrong
Here is the code
$infusionsoft->contacts('xml')->addToGroup($contactId, $tagId);
GUYS ANY HELP WILL BE APPRECIATED
@Rohan_Jalil,
I don’t usually use the api for REST calls but if I’m not mistaken, you have to call load() first and then addToGroup. Either way ->contacts(‘xml’) would not be valid. I’m sure that you don’t have a contact that has an string id of ‘xml’
I’m using this api from xmlrpc
https://developer.infusionsoft.com/docs/xml-rpc/#contact-add-a-tag-to-a-contact
The reason why I’m putting ‘xml’ string in contact is because if I do not, it starts calling the rest api
This is the contact function in your sdk for contact
/**
* @return \Infusionsoft\Api\ContactService
*/
public function contacts($api = 'rest')
{
if ($api == 'xml') {
return $this->getApi('ContactService');
}
return $this->getRestApi('ContactService');
}
k so in that case you have to first instantiate the contact object $conService=$infusionsoft->contacts(‘xml’);
and then call the method $conService->addToGroup($contactId, $tagId);
ok let me check and then I’ll get back to you give me a minute
Nope I’m still getting the same error
Looking over the stack message again. Are you able to call any methods at all?
Well I’m trying to retrieve a contact but it throws me this error
Infusionsoft\Http\HttpException: fXmlRpc\Exception\FaultException: [RecordNotFound]Record was not found in
This is the function that I’m using
$infusionsoft->contacts('xml')->load($contactId, ['FirstName'])
But the contact exist in infusionsoft
Just a side not 7787 was stored as a string in my system and then I changed it into integer like this
(int)$contact_id
I have checked the contactid type and it’s integer. Can you please tell me what is it that is going wrong ?
Thanks
When I use this function it return me a empty array
$is_result = $infusionsoft->data()->query("Contact",10,0,$query_fields,$returnFields,'Id',true);
Can you tell me what is it that is going wrong
Start with what version of PHP are you running? Some versions don’t support the format for arrays. I would just always use array(‘FirstName’) (as an example). If you change that from the bracket version in your load method then it should return the contact with just the first name field.
As far as your query goes, just get a basic working first. Replace $query_fields with just array(‘%’) (which will request and entire list but it will verify if things to that point are working or not.