Calling leadApi returns The response returned is in an unexpected format

I am trying to create new lead but any calling ends in error 500: The response returned is in an unexpected format



I am doing this:

Code:
$leadApi = MauticMauticApi::getContext( "leads", $auth, $mauticBaseUrl );

$fields = $leadApi->getFieldList();


and the above call ends in already mentioned error. This is how the leadApi object looks if i call
Code:
print_r
on it:
Code:
MauticApiLeads Object ( [endpoint:protected] => leads [baseUrl:protected] => http://mautic.mywii.cz [auth:MauticApiApi:private] => MauticAuthOAuth Object ( [_client_id:protected] => 4sc07f856ayowwg4goksw8swgg44cow0kocgwogoww0oc4w0gc [_client_secret:protected] => 1zxgxulnl4pw0cs4o0kwookgowgwwkk48os4w0ws0wo4c0oo40 [_callback:protected] => http://mywii.cz/?edd-listener=mautic [_access_token:protected] => 5088ugpt5egwcwsckog4sw8ockk0k40k00cwg0ok444848084g [_access_token_secret:protected] => 1e8aix94n2jo88scsoooow880sckg4sso4wgkkwwwc8wss8wwo [_expires:protected] => [_refresh_token:protected] => [_token_type:protected] => [_access_token_updated:protected] => [_redirect_type:protected] => code [_scope:protected] => Array ( )
        [_authorize_url:protected] => http://mautic.mywii.cz/oauth/v1/authorize
        [_access_token_url:protected] => http://mautic.mywii.cz/oauth/v1/access_token
        [_request_token_url:protected] => http://mautic.mywii.cz/oauth/v1/request_token
        [_debug:protected] => 
    )

[logger:MauticApiApi:private] => PsrLogNullLogger Object
    (
    )

)


Is there some obvious error I done? What should I do next in order to debug this?

Same message here…

I tested it with the API tester and it returned the array for me:

Other API calls work?

[quote=9184:@escopecz]I tested it with the API tester and it returned the array for me:

Other API calls work?[/quote]

This was actually the first time I tried to use Apitester :slight_smile: but, surprisingly, I cannot even use apitester because I am getting this error:

Warning: require(): Unable to access /vendor/autoload.php in /apitester/index.php on line 5

The line in apitester/index.php says:

require dirname(__DIR__).'/vendor/autoload.php';

Looking at original Github api library I cannot see anywhere the “vendor” subfolder anywhere…

Should I raise github issue for that or is this note enough?

I see. You need to run composer install to install the vendor libraries. I can see it’s not in the readme…

I am trying to create new lead but any calling ends in error 500: The response returned is in an unexpected format

I am doing this:

$leadApi    = MauticMauticApi::getContext(
    "leads",
    $auth,
    $mauticBaseUrl 
);  

$fields = $leadApi->getFieldList();

and the above call ends in already mentioned error. This is how the leadApi object looks if i call print_r on it:

MauticApiLeads Object
(
    [endpoint:protected] => leads
    [baseUrl:protected] => http://mautic.mywii.cz
    [auth:MauticApiApi:private] => MauticAuthOAuth Object
        (
            [_client_id:protected] => 4sc07f856ayowwg4goksw8swgg44cow0kocgwogoww0oc4w0gc
            [_client_secret:protected] => 1zxgxulnl4pw0cs4o0kwookgowgwwkk48os4w0ws0wo4c0oo40
            [_callback:protected] => http://mywii.cz/?edd-listener=mautic
            [_access_token:protected] => 5088ugpt5egwcwsckog4sw8ockk0k40k00cwg0ok444848084g
            [_access_token_secret:protected] => 1e8aix94n2jo88scsoooow880sckg4sso4wgkkwwwc8wss8wwo
            [_expires:protected] => 
            [_refresh_token:protected] => 
            [_token_type:protected] => 
            [_access_token_updated:protected] => 
            [_redirect_type:protected] => code
            [_scope:protected] => Array
                (
                )

            [_authorize_url:protected] => http://mautic.mywii.cz/oauth/v1/authorize
            [_access_token_url:protected] => http://mautic.mywii.cz/oauth/v1/access_token
            [_request_token_url:protected] => http://mautic.mywii.cz/oauth/v1/request_token
            [_debug:protected] => 
        )

    [logger:MauticApiApi:private] => PsrLogNullLogger Object
        (
        )

)

Is there some obvious error I done? What should I do next in order to debug this?