Curious what the callback URI is in the API. Attempting to use the api tester and failing every time. Im not sure what the callback should be. I have the api library on my site and just simply trying to do a test. It says the callback should be the same URI that is calling it, but does that mean I have to create a file for each and every call I make that uses the API?
Im thoroughly confused by the API and could use some assistance.
Also having questions about WHERE the api-library exists. In my main project alongside mastic? In my site that is calling mastic api? both? I am not seeing whats happening here unfortunately. Any help is appreciated.
Curious what the callback URI is in the API. Attempting to use the api tester and failing every time. Im not sure what the callback should be. I have the api library on my site and just simply trying to do a test. It says the callback should be the same URI that is calling it, but does that mean I have to create a file for each and every call I make that uses the API?
Im thoroughly confused by the API and could use some assistance.
Mautic API is integrated into Mautic, so that part is clear.
Mautic API tester was developed to test/debug the Mautic API and the Mautic API library (https://github.com/mautic/api-library)
Mautic API library is collection of PHP classes which helps developers to connect their PHP apps with Mautic.
If you want to use the API tester,
- clone the repository (link above)
- Open the API library in your browser and add /apitester. That will open the API tester.
- Insert Mautic URL to the field called Mautic URL. That is base URL of your Mautic installation.
- Hit Submit button. That will save the Mautic URL to the session and will stay there after refresh.
- Authorize via one of the oAuth methods. Just copy-paste the key and secret generated by Mautic and hit Authorize.
- If authorization was successful, you can test some API calls. Make sure you use POST for updating/creating stuff and GET for receiving stuff.
I have two domains. 1 that hosts mastic with my normal website, and another that hosts the services for an iPhone app. I would like for the iPhone app to register a user using the services, and the services make the API request to mautic to add the lead to mautic.
Maybe this helps clarify my issue.
Im assuming my callback URI is the URI of the service host…correct?
But I guess where the wheels fall off for me is how to use OAuth to redirect etc when all I want to do is pass data to Mautic.
Thanks for the response!
Just got it working with callbacks, took me to Mautic login and all is well, BUT, my situation still is confusing. How would I simply make a call to the API from my services domain to the domain hosting mautic?
This would be amazing.
I guess your iPhone app doesn’t run on PHP. The Mautic API uses standard REST API which can be used with HTTP calls from any programming language. OAuth is also standard which can be used by any programming language.
EDIT: But the oAuth as is implemented right now in Mautic requires to open the confirmation page in a browser. Not sure if that’s something a iOS app can do.
Right, so the iPhone app sends a POST request to my service endpoints. That endpoint is in PHP. The endpoint is what I would like to send the API request to Mautic to add that new registration as a lead in Mautic.
So the browser confirmation is what is jamming me up. Im trying to think of a good solution because I cannot be the only person wanting to add a lead from a registration without having that user have to login to Mautic. If that is the case, then I am totally confused as to why someone would use the API.
There has to be a way to send a request with tokens to mautic from a domain without having to confirm…right?
Yeah, the API is for more advanced things. Maybe this would do it for you
https://medium.com/@jan_linhart/the-simplest-way-how-to-submit-a-form-data-to-mautic-1454d3afd005
I would also like to change field values for leads, add points, etc, from my service layer in PHP. So you are saying that the API can only work if you have the browser authentication?
There should be a way to simply use the tokens, etc, to send requests to the API from a domain without having to go through the browser authentication.
For instance, in my software, a user can get a golf lesson…I would like to increment the field value “number of lessons” for that lead from my service layer…
Yes, API works only when the app is authenticated. But only the PHP app you mentioned would have to be authenticated. I’d also like some simpler authentication process like a token. You can create a feature request for it on GitHub.
Field values can be changed via form submissions. New value will override the old one. Lead points can be changed in Mautic workflows based on lead’s actions. No need to use the API for it.
I see. So maybe I will create a form submission each time a user gets a lesson in my app.
App -> Service -> POST to Mautic with new lesson count (just seems so hacky)
I love Mautic so far and would really love to get down and dirty and do some really cool things…maybe Ill look into this a bit more and see if there is a way…
Ill check on github to see if I can make a feature request…
Um…escopecz, can you give those instructions in non-php/github expert terms?
I looked up how to clone the repository, installed git-bash for that purpose, and all that seems to have done is create an api-library in “My Documents.” Okay, well I could have accomplished that with zip, but how exactly do I open that in the browser? What does “add in /api-tester” mean? Do you mean open C:UsersCreggapi-libraryapitester in the browser? That’s just a directory. That gets me nothing, and the browser doesn’t know how to run php, so…what am I missing?
Seems like the further computer tech goes, the further backward it goes. I don’t want the labor pains, just the baby (which in this case, is an api testing tool I can run to help debug why Mautic isn’t returning any segments when called by ThriveLeads).
Thanks much.
[quote=19265:@cStuartHardwick]Um…escopecz, can you give those instructions in non-php/github expert terms?
I looked up how to clone the repository, installed git-bash for that purpose, and all that seems to have done is create an api-library in “My Documents.” Okay, well I could have accomplished that with zip, but how exactly do I open that in the browser? What does “add in /api-tester” mean? Do you mean open C:UsersCreggapi-libraryapitester in the browser? That’s just a directory. That gets me nothing, and the browser doesn’t know how to run php, so…what am I missing?
Seems like the further computer tech goes, the further backward it goes. I don’t want the labor pains, just the baby (which in this case, is an api testing tool I can run to help debug why Mautic isn’t returning any segments when called by ThriveLeads).
Thanks much.[/quote]
@cStuartHardwick : Here’s some more info that might help you:: In order to run the api-library properly, PHP needs to be installed o n the web server–so, the easiest was to accomplish that is to upload the library to the web server where you are hosting Mautic (or any other web page). Just upload the zipfile from GitHub and extract it with your web host’s file manager once it’s on the server. You will then be able to open the apitester
page and use it.
I realize this reply is a little after the fact, but hopefully someone else reading will find it useful.