Mautic Community Forums

Error adding to the list of lead

Hi. Working with the API faced with the following problem. When I try to add a lead in the list get the following error Array ( [error] => Array ( => 404 [message] => Item was not found. ) )). When added to the list in the lead of the crm no errors. With what it can be connected? Just does not work to add lead in campaign Array ( [error] => Array ( [message] => Property MauticCampaignBundleEntityCampaign::$title does not exist [code] => 0 ) ), but you already know about it.[code] => 404 [message] => Item was not found. ) )). When added to the list in the lead of the crm no errors. With what it can be connected? Just does not work to add lead in campaign Array ( [error] => Array ( [message] => Property MauticCampaignBundleEntityCampaign::$title does not exist => 0 ) ), but you already know about it.[code] => 0 ) ), but you already know about it.

If you find a bug in the documentation, please fix it and send a pull request:

https://github.com/mautic/developer-documentation

Hi. Working with the API faced with the following problem. When I try to add a lead in the list get the following error Array ( [error] => Array ( [code] => 404 [message] => Item was not found. ) )). When added to the list in the lead of the crm no errors. With what it can be connected? Just does not work to add lead in campaign Array ( [error] => Array ( [message] => Property MauticCampaignBundleEntityCampaign::$title does not exist [code] => 0 ) ), but you already know about it.

I’m sorry I don’t understand your report. Is that a error message which the issue generates in the logs?

Array ( [error] => Array ( [message] => Property MauticCampaignBundleEntityCampaign::$title does not exist [code] => 0 ) )

What’s that note related to?

I use the library api matic. When I try to add a lead in the list, I get the following error.

Array ( [error] => Array ( [code] => 404 [message] => Item was not found. ) )).

my code

[code] public function addLeadToList()
{
if( isset($_GET[‘listId’])){
$leadId = json_decode($_SESSION[‘contact’], true)[‘id’];
$listId = $_GET[‘listId’];
$auth = $this->Auth();
$listApi = MauticApi::getContext(“lists”, $auth, $this->apiUrl);
$response = $listApi->addLead($leadId, $listId);
if(isset($response[‘success’])){
print_r(true);
}else{
print_r(‘false’);
}

    } else{
        print_r('false');
    }

}[/code]

This issue had already been discussed and it is still not fixed. When I make a request for a list of campaign, I get an answer

Array ( [error] => Array ( [message] => Property MauticCampaignBundleEntityCampaign::$title does not exist [code] => 0 ) )

https://www.mautic.org/community/index.php/828-bug-rest-api-for-get-campaign-erroring-out/0

My code

[code]public function getArrayCampaigns()
{
$auth = $this->Auth();
$campaignApi = MauticApi::getContext(“campaigns”, $auth,$this->apiUrl);
$campaigns = $campaignApi->getList();
$array_campaigns = [];
foreach($campaigns[‘campaigns’] as $key => $value){
$array_campaigns[$value[‘id’]] = $value[‘name’];
}

    print_r($campaigns);

    
}[/code]

Ahh, I understand now. The fix for this issue is here:

https://github.com/mautic/mautic/pull/968

and it’s waiting to be tested. After it will be tested it can be merged to the core and released in Mautic 1.2.1.

If you’d be so kind and test that, please, write the comment if the PR solves the error. Your comment will help a lot.

This fix solves the problem?

[code]I use the library api matic. When I try to add a lead in the list, I get the following error.

Array ( [error] => Array ( => 404 [message] => Item was not found. ) )). my code
How to fix a bug if I use the online version of mautic

I tried to create a lead via API few minutes ago to answer similar question. It works for me. Take a look:
https://www.mautic.org/community/index.php/968-getleadidbyemail

Write to the support of that service and ask if they could implement that fix.

I found a solution to this problem.

Array ( [error] => Array ( [code] => 404 [message] => Item was not found. ) )). my code
The problem is that in all the documents mixed up leadId and listId. This also applies to work with the campaign. Please fix documentation
code documentation

$response = $listApi->addLead($leadId, $listId); if (!isset($response['success'])) { // handle error }
correct my code

$listApi = MauticApi::getContext("lists", $auth, $this->apiUrl); $response = $listApi->addLead($listId, $leadId); if(isset($response['success'])){ print_r(true); }else{ print_r('false'); }
https://developer.mautic.org/#list-lead-lists

Do I understand correctly that this is not fixbug connects with the main branch mautic An online version will be error when working with campaing?
https://github.com/mautic/mautic/pull/968