Announcement

Collapse
No announcement yet.

Create Quote with api Rest

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create Quote with api Rest

    Hello,


    I wanted to make a simple test of creation of a quote via the API and I send the name of the quote for the moment. I work in php and I use the API client https://github.com/espocrm/documenta...-client-php.md below the code I made

    PHP Code:
    include 'espocrm.php' ;
    $client = new EspoApiClient('mycloudcrmurl');
    $client->setApiKey('myapikey');
    $response $client->request('POST''Quote', [
        
    'name'=> 'testt'
    ]);

    var_dump$response); 
    Response :

    PHP Code:
    PHP Fatal error:espocrm.php:138
    Stack trace
    :
    #0 testEspoAPI.php(11): EspoApiClient->request('POST', 'Quote', Array)
    #1 {main}
      
    thrown in espocrm.php on line 138 
    I did the same test to create a lead and it works without problems and also to create an account. Something escapes me for creating quotes?
    Note: I'm working on the demo cloud version.

  • #2
    Does the user have a create access for quote entity?

    Comment


    • #3
      You can try catch request and print $client->getResponseHttpCode();

      Comment


      • #4
        Hi Yuri,
        Thanks for your replay
        with try catch echo $e->getMessage() ; return :
        PHP Code:
        EspoClientUnknown Error 
        and if i try print $client->getResponseHttpCode(); in catch i have :

        PHP Code:
        EspoClientUnknown ErrorPHP Warning:  curl_getinfo(): 5 is not a valid cURL handle resource in espocrm.php on line 179 
        you can see in the attachment capture the rights attributed to the user, What I can not understand is that I gave all possible rights to the user but I always disabled on the Quote line.


        I can give you to my demo environment if you want to check or test yourself.

        Thanks you

        Comment


        • #5
          Make sure you have enabled create access in at least one of roles assigned to your API User.

          Clear cache just in case.

          Comment


          • #6

            Thank you very much Yuri that was the problem

            Comment

            Working...
            X