Mautic Community Forums

Calling Mautic API?

Hi guys,



I’d like to link Mautic with our website (Ruby and Rails) to ensure all the new registration are added to our Mautic leads pool.



However we were not able to find the documentation on how to call the API.



I only found the API PHP Library https://github.com/mautic/api-library



Any idea where I can find it?



Thanks

Hi guys,

I’d like to link Mautic with our website (Ruby and Rails) to ensure all the new registration are added to our Mautic leads pool.

However we were not able to find the documentation on how to call the API.

I only found the API PHP Library https://github.com/mautic/api-library

Any idea where I can find it?

Thanks

Hi Karibu

There isn’t any documentation published on the API yet - but here’s some basic guidelines:

  1. You’ll need to enable the API in Mautic and turn on the Oauth authentication, and generate API keys.

  2. You’ll need to authenticate the app to Mautic using the Oauth process.

The process is mostly documented on the github repo under ‘authorization’.

After that you’ll need to use the create lead endpoints. See the ‘creating an item’ section of the github repo readme for the API for sample code on that.

Finally - if you want to actual code to look at, any of our CMS plugins would be good. So:

Authorize function:
https://github.com/mautic/mautic-joomla/blob/master/mautic.php#L240

Create new lead:
https://github.com/mautic/mautic-joomla/blob/master/mautic.php#L296

Unfortunately all the examples are in PHP, but the Oauth logic process will be the same in Ruby and all you’ll need to do is translate the php functions to Ruby.

Definitely let us know how it turns out. We’d love to see some sample code in Ruby!

Hi guys,

Our dev will be looking into it soon but he expect some documentation or examples on how to call the API to speed up his work (As he has many features to implement on others parts of our project).

Did anyone there have been successful with Mautic API with Ruby? Any sample code or good practices?

Thank you!

Hi Karibu

Not sure if this will help any more but here’s a list of all the end points:

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

And the only thing missing there is the http verbs, which are here:

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

That’ll just be get / post for read/write.

Hey @karibu I’m looking to use Mautic on a Ruby on Rails application. Is it possible for you to open source your implementation of the Mautic API wrapper in Ruby, any help would be appreciated. I’m sure a lot of people from the Rails community would like to use Mautic as well.

If we could help make an official Ruby wrapper of the API that would be awesome.