Mautic Community Forums

Help with Mautic API - apitester

Hello everyone,



I’m a Mautic Newbie. I’ve been testing the tool for some weeks now and I think I’ll adop the tool for my marketing automation efforts. The tool has worked pretty fine in all that has to do to the “interface” related tasks. Right now, I’m testing the API and it has been difficult to make it work, starting from the authorization.



Before writing down any code, I’m using the apitester tool (php) , and I’m not able to make it work. I installed it in my server, I am able to see the interface, but it does not seem to work. I receive blank responses from the mautic server. I add the authorization key and secrete, and my callback URL, but when I click to authorize the tool does not work. At list is not showing anything in the response tabl.



The apitester is in my localhost, while my mautic instalation is in a public URL.



I would appreciate any help on this, as being able to integrate the tool with my system and making thing happen based on events in my site is what will make this really useful.



Thanks in advance,



GV

Hello everyone,

I’m a Mautic Newbie. I’ve been testing the tool for some weeks now and I think I’ll adop the tool for my marketing automation efforts. The tool has worked pretty fine in all that has to do to the “interface” related tasks. Right now, I’m testing the API and it has been difficult to make it work, starting from the authorization.

Before writing down any code, I’m using the apitester tool (php) , and I’m not able to make it work. I installed it in my server, I am able to see the interface, but it does not seem to work. I receive blank responses from the mautic server. I add the authorization key and secrete, and my callback URL, but when I click to authorize the tool does not work. At list is not showing anything in the response tabl.

The apitester is in my localhost, while my mautic instalation is in a public URL.

I would appreciate any help on this, as being able to integrate the tool with my system and making thing happen based on events in my site is what will make this really useful.

Thanks in advance,

GV

I think it will be because the callbacks cannot access your localhost. Either test both (the API Tester and Mautic) on your localhost or both on a publicly accessible URL.

Hi escopecz,

Thank you for your reply. I’m not sure that’s the case.

The callback URIs are used only to redirect your browser with the authorization result, thus a localhost-based callback URI should work. I used this method in other oAuth services and worked.

Any other suggestions ?

GV

Why don’t you give it a try? The callback URL also holds the token which is the key you need to make the API requests.

Hi escopecz,

I’ll try it today and let you know.
Thank you for your help.

Regards,

GV

Hi escopecz ,

I was able to make the apitester work. The problem was the @Kint::dump method. As I did not installed it with composer (I just downloaded it in my project) the module was not there.

Now that the API works (using my localhost URI, and pointing to my online mautic install) I have a new questions. When I authorize the apitester, it redirects me to the mautic login, and after I write down my credentials, It requests me to accept the application.

This let me thinking how can I use the API to the purpose I originally thought I would. What I want to do with the API is to add Contact to Segments, based on my application backend. Said this, I wanted my application backend to call the api when some processes happened. So, will this work ? I mean, the redirect to the mautic login, how do I avoid this ?

Please let me know if I was able to explain the scenario.

Regards,

GV