Mautic Community Forums

Mautic API - Non-Composer Install

[h]SEEKING[/h]

I am seeking a clear set of step-by-step instructions on how to setup MAUTIC API on a shared server that does not support, or allow to be installed, the

Code:
composer
tool.

* Should my Mautic install directory adhere to a specific name? -- I am using:
Code:
domain/m/
* Should the Mautic API be installed in a specific location? -- I am using:
Code:
domain/m/api/
* What files (configuration or otherwise) do I need alter, create, comment or delete?
* And if there are file edits/creations required, what must be added, changed, deleted, commented or created?

[h]BACKGROUND[/h]
I have been working on getting MAUTIC API to work on a Shared Server, where the hosting provider does not allow
Code:
composer
to be installed. I have followed all the documentation I can find on the GIT site for MAUTIC API, and read through a series of posts since 2015. There are nuggets of information I have applied, and each gets me a bit closer, but since I do not understand the Mautic architecture well enough, I am a bit lost on where to look, and how to complete this installation to the point that it will function, as I am sure it does for
Code:
composer
installs.

[h]CURRENT STATUS (as of June 6, 2017)[/h]
I will spare you the series of edits, tests and trials that brought me to my Current Status, which is:
* I installed the PHP API Library from: https://github.com/mautic/api-library
* I created the
Code:
Autoload.php
file as directed and placed it in the
Code:
/api/
directory.
* I can load the
Code:
/apitester/
form.
* I can Authenticate using OAuth1a via the
Code:
/apitester/
form.
* I CANNOT get a GET statement to process.
Code:
FORM FIELDS /api/ contacts / OAuth1a GET KEY = id VALUE = 1

[h]ENVIRONMENT[/h]
* PHP Version 7.0.18
* Mautic 2.8.2 (Stable)
* Mautic API 2.6.0

[h]...app/config/security.php API Settings[/h]
Code:
'api' => [ 'pattern' => '^/api', 'fos_oauth' => true, 'bazinga_oauth' => true, 'mautic_plugin_auth' => true, 'stateless' => true, 'http_basic' => '%mautic.api_enable_basic_auth%', ],

[h]THE ERROR[/h]
Code:
Fatal error: Uncaught Error: Class 'MauticAuthApiAuth' not found in /api/apitester/index.php:142 Stack trace: #0 {main} thrown in /api/apitester/index.php on line 142

[h]...apitester/index.php LINE 142[/h]
Code:
142: $oauthObject = MauticAuthApiAuth::initiate( 143: array( 144: 'baseUrl' => $oauthBaseUrl, 145: 'version' => $auth, 146: 'clientKey' => ($auth == 'OAuth1a') ? $consumerKey : $clientKey, 147: 'clientSecret' => ($auth == 'OAuth1a') ? $consumerSecret : $clientSecret, 148: 'callback' => $callback, 149: 'scope' => $scope 150: ) 151: );


[h]CLOSING COMMENT[/h]
While I was able to resolve the other
Code:
class
and
Code:
/filepath/
statements, this error has me baffled. Or I am at my wits end and decided to finally reach out for help -- either way, a concise instruction set for Shared Server Non-Composer environments would be great to have for two reasons.
Quote:
1. So I can complete the installation and move on to the business of why I installed the Mautic API.
2. To help others have an easier time with their installs for a similar hosting environment (aka: non-composer).

Thank you in advance.
Quote:
I was not sure if this should be in DOCS or SUPPORT.
It makes sense to start in SUPPORT and move it later (once resolved) to DOCS.

[h]SEEKING[/h]
I am seeking a clear set of step-by-step instructions on how to setup MAUTIC API on a shared server that does not support, or allow to be installed, the composer tool.

  • Should my Mautic install directory adhere to a specific name? – I am using: domain/m/
  • Should the Mautic API be installed in a specific location? – I am using: domain/m/api/
  • What files (configuration or otherwise) do I need alter, create, comment or delete?
  • And if there are file edits/creations required, what must be added, changed, deleted, commented or created?

[h]BACKGROUND[/h]
I have been working on getting MAUTIC API to work on a Shared Server, where the hosting provider does not allow composer to be installed. I have followed all the documentation I can find on the GIT site for MAUTIC API, and read through a series of posts since 2015. There are nuggets of information I have applied, and each gets me a bit closer, but since I do not understand the Mautic architecture well enough, I am a bit lost on where to look, and how to complete this installation to the point that it will function, as I am sure it does for composer installs.

[h]CURRENT STATUS (as of June 6, 2017)[/h]
I will spare you the series of edits, tests and trials that brought me to my Current Status, which is:

  • I installed the PHP API Library from: https://github.com/mautic/api-library
  • I created the Autoload.php file as directed and placed it in the /api/ directory.
  • I can load the /apitester/ form.
  • I can Authenticate using OAuth1a via the /apitester/ form.
  • I CANNOT get a GET statement to process.
FORM FIELDS
  <domain/path-to-mautic>  /api/  contacts  /  OAuth1a GET 
  KEY = id
  VALUE = 1

[h]ENVIRONMENT[/h]

  • PHP Version 7.0.18
  • Mautic 2.8.2 (Stable)
  • Mautic API 2.6.0

[h]…app/config/security.php API Settings[/h]

'api' => [
        'pattern'            => '^/api',
        'fos_oauth'          => true,
        'bazinga_oauth'      => true,
        'mautic_plugin_auth' => true,
        'stateless'          => true,
        'http_basic'         => '%mautic.api_enable_basic_auth%',
    ],

[h]THE ERROR[/h]

Fatal error: Uncaught Error: Class 'MauticAuthApiAuth' not found in <path-to-mautic>/api/apitester/index.php:142 Stack trace: #0 {main} thrown in <path-to-mautic>/api/apitester/index.php on line 142

[h]…apitester/index.php LINE 142[/h]

142: $oauthObject = MauticAuthApiAuth::initiate(
143:            array(
144:                'baseUrl'       => $oauthBaseUrl,
145:                'version'       => $auth,
146:                'clientKey'     => ($auth == 'OAuth1a') ? $consumerKey : $clientKey,
147:                'clientSecret'  => ($auth == 'OAuth1a') ? $consumerSecret : $clientSecret,
148:                'callback'      => $callback,
149:                'scope'         => $scope
150:            )
151:        );

[h]CLOSING COMMENT[/h]
While I was able to resolve the other class and /filepath/ statements, this error has me baffled. Or I am at my wits end and decided to finally reach out for help – either way, a concise instruction set for Shared Server Non-Composer environments would be great to have for two reasons.

[quote]1. So I can complete the installation and move on to the business of why I installed the Mautic API.
2. To help others have an easier time with their installs for a similar hosting environment (aka: non-composer).[/quote]

Thank you in advance.

[quote]I was not sure if this should be in DOCS or SUPPORT.
It makes sense to start in SUPPORT and move it later (once resolved) to DOCS.[/quote]

What link?

[b]Q: Are talking about the PHP API Library?
A: I did that as I outlined above.

That is what I did originally, and then upgraded to 2.8.2.
Are you suggesting that I delete my current installation and re-install?

@kuzmany Thank you for that thought, that’s actually helpful. I was trying to avoid adding a development environment, but I get what you are saying, if I use the PREP procedure, it should resolve my issues.

1. Set up a PREP server environment on my local machine (WAMP for example).
2. Install COMPOSER. 
3. Install MAUTIC.
4. Install MAUTIC API LIBRARY.
5. Install MAUTIC PHP API LIBRARY.
6. Configure Mautic.
7. Test the Mautic instance.
8. Test the Mautic API functionality.
9. ZIP up the working MAUTIC instance (directory).
10. Upload the ZIP file to my hosting environment.
11. Unpack the ZIP file.
12. Edit the Mautic server settings for it's new server environment.
13. Test the Mautic instance.
14. Test the Mautic API functionality.

Is there anything I missed?

@MxyzptlkFishStix
I signed up, profile is: ab-derek
I have notifications turned on.
I plan to follow @kuzmany 's suggestion, but if you have a quicker solution, let me know.