# Error adding to the list of lead

**URL:** <https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588>\
**Category:** Development\
**Created:** [October 14, 2015, 8:15am UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588 "2015-10-14T08:15:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 8:15am UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/1 "2015-10-14T08:15:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 15, 2015, 6:06am UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/2 "2015-10-15T06:06:44Z")

</div>

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

[https://github.com/mautic/developer-documentation](https://github.com/mautic/developer-documentation)

---

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 8:15am UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/3 "2015-10-14T08:15:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 14, 2015, 9:40am UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/4 "2015-10-14T09:40:21Z")

</div>

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

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

What’s that note related to?

> [@](#):
>
> but you already know about it

---

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 12:33pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/5 "2015-10-14T12:33:14Z")

</div>

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

```auto
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

```auto
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](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]
```

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 14, 2015, 12:40pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/6 "2015-10-14T12:40:38Z")

</div>

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

[https://github.com/mautic/mautic/pull/968](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.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 14, 2015, 1:21pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/7 "2015-10-14T13:21:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 4:37pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/8 "2015-10-14T16:37:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 14, 2015, 4:48pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/9 "2015-10-14T16:48:36Z")

</div>

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](https://www.mautic.org/community/index.php/968-getleadidbyemail)

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

---

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 7:50pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/10 "2015-10-14T19:50:35Z")

</div>

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](https://developer.mautic.org/#list-lead-lists)

---

<div class="post-metadata">

**Author:** ![sergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sergeyK](https://forum.mautic.org/u/sergeyK)\
**Post date:** [October 14, 2015, 7:54pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/11 "2015-10-14T19:54:52Z")

</div>

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](https://github.com/mautic/mautic/pull/968)

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:57pm UTC](https://forum.mautic.org/t/error-adding-to-the-list-of-lead/2588/12 "2020-02-02T22:57:50Z")

</div>


