Mautic Community Forums

Update leads via API

I’m trying to update or create lead via API using C#. I’ve look into mautic api library, but I didn’t found method, which updates lead, so I cannot understand in which format I have to build web-request.

There are some examples in library description how to create/update lead, but there no such methods in ‘lib/Api/Leads.php’. Maybe I missed something, and these methods are in some other place?

It would be great to know, what exactly format API requires. But unfortunately I didn’t found any related information.

Thanks

I’m trying to update or create lead via API using C#. I’ve look into mautic api library, but I didn’t found method, which updates lead, so I cannot understand in which format I have to build web-request.
There are some examples in library description how to create/update lead, but there no such methods in ‘lib/Api/Leads.php’. Maybe I missed something, and these methods are in some other place?
It would be great to know, what exactly format API requires. But unfortunately I didn’t found any related information.
Thanks

Hi Dima,

The Api endpoints are listed out in this file pathtomauticappbundlesLeadBundleConfigconfig.php . There is both the internal endpoints and web endpoints in that file so be carefull. You should just be able to just PUT the fields in using URL parameters. For example my.mauticsite.com/api/v2/leads/{id}/edit?firstname=Testname&lastname=TestLastName and so on for the fields having the alias name in Mautic->Leads->Lead fields.

Hopefully that all makes sense, the Api works as you would expect when using GET, PUT’s, DELETE and so on.

Zac

Hi Zac,

Great! Now it’s much clear.

Thanks

Check this out:

https://github.com/mautic/api-library/tree/master/apitester/endpoints

All the endpoints are listed here in the JSON format. The only thing that isn’t really clear is which http verbs to use, but the read / write contexts are here:

https://github.com/mautic/api-library#get-a-context-object

Is it possible to update a lead and lead info (or add a lead) via API if we are using the Mautic.Com hosted solution?

Hi @dima so where are you updating leads from? How does your integration work? I’m studying different ways of integrating leads from Sugar so I was wandering if I could get some tips from you.

Hi @dima

Have you had any luck creating the lead update API. I am trying to find out a way to make that for my wordpress website.