Cannot succesvol create PHP API script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ITI
    Junior Member
    • Feb 2020
    • 7

    #1

    Cannot succesvol create PHP API script

    I follow this tutorial but get direct errors.


    After the command " composer require espocrm/php-espo-api-client " my ESPO in browser give errors, so everything stopped direct.
    I have to fall back on my backup.

    Errors I see >>

    AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Class "Espo\\Core\\Application"
    not found in /var/www/vhosts/<URL>/public/api/v1/index.php:35\nStack trace:\n#0 {main}\n thrown in /var/www/vhosts/<URL>/public/api/v1/index.php on line 35'


    I want to add an Call via an own PHP script.
    Tested Espo CRM version ​Version 9.1.9 and also 9.3.1

    Many thanks in advance
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9666

    #2
    You should not have done it in your Espo. It's supposed to be done at a remote environment, to connect to Espo remotely.

    Comment

    • ITI
      Junior Member
      • Feb 2020
      • 7

      #3
      Thanx for your quick response.

      After a day search I saw a another warning: "[2026-02-19 10:37:12] WARNING: (400) Field validation failure; entityType: Call, field: dateStart, type: valid. :: POST /Call"

      That fixed the problem, my dateStart field format was not correct
      We did give: "2026/02/19 10:37:12"
      But it must be: "2026-02-19 10:37:12"

      Before the upgrade it worked fine. After change evrything works fine.

      But still want to use the API in the good way.
      So it is possible to use the API without composer?
      Do somebody have a really simple PHP example?

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9666

        #4


        On the right, select the language to show an example.

        Click image for larger version  Name:	image.png Views:	0 Size:	52.2 KB ID:	124860


        Important. This docs does not include the authentication X-Api-Key header in examples (maybe an issue in the API docs engine). You need to include it.

        Comment

        Working...