EspoApiClient error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thefancezzz
    Junior Member
    • Jul 2020
    • 2

    EspoApiClient error

    Hello, I'm new here and try to figure out how to use API. I read documentation and still nothing happens.

    There is a error:

    Fatal error: Uncaught Exception: EspoClient: Unknown Error in C:\xampp\htdocs\espo\Test.php:163 Stack trace: #0 C:\xampp\htdocs\espo\Test.php(24): EspoApiClient->request('POST', 'Lead', Array) #1 C:\xampp\htdocs\espo\Test.php(234): test->insert() #2 {main} thrown in C:\xampp\htdocs\espo\Test.php on line 163

    That's the code:
    PHP Code:
    public function insert()
    { $url = 'https://127.0.0.1/espo';
    $client = new EspoApiClient($url);
    $client->setApiKey("d6901311d3553408e9cd1676243ff6f2");
    $response = $client->request('POST', 'Lead', [ 'firstName'=> 'test', 'lastName'=> 'hello']); } 
    
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Here's a step by step guide to create an API with PHP, hopefully this can help

    https://forum.espocrm.com/forum/deve...46-api-example

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2204

      #3
      I use Test API Software (for example Postman or Insomnia) to test out API system, perhaps that is something you can consider trying before start using the code.

      Comment

      Working...