Announcement

Collapse
No announcement yet.

Updating the currency rate by API

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

  • #16
    Corrected. But I wrote above that I tried different options and they do not work.

    'CurrencyRate'
    'currencyRate'
    'currency'

    There are no errors, but there is no result.

    Comment


    • #17
      Hi,
      i think Yuri say this :
      PHP Code:

      try {
          
      $response $client->request(
              
      'PUT',
              
      'CurrencyRate',   <---
              [
      'EUR' => 1.19]
          );
      } catch (
      \Exception $e) {
          
      $errorCode $e->getCode();

      Last edited by item; 10-22-2020, 08:32 PM.

      Comment


      • #18
        <?php
        require_once('EspoApiClient.php');

        $url = 'https://aaaaaaaaaaa.com/crm/';
        $apiKey = '2e5ca0f7***************c60684e9';

        $client = new EspoApiClient($url);
        $client->setApiKey($apiKey);

        try {
        $response = $client->request(
        'PUT',
        'CurrencyRate',
        ['EUR' => 1.7777]
        );
        } catch (\Exception $e) {
        $errorCode = $e->getCode();
        }
        ?>


        Yes. I understood you correctly. I meant that I tried different options.

        Comment


        • #19
          Has anyone tested this on their own? Does it even work?

          Comment


          • #20
            The snippet I provided above was tested and it worked.

            Comment


            • #21
              I have this code and always return 400, I think is (bad request error)

              <?php

              require_once('EspoApiClient.php');

              $url = 'http://17X.XX.XX.X4/bis/';
              $apiKey = '997e6xxxxxxxxxxxxxxxxxxxx529bf2';

              $client = new EspoApiClient($url);
              $client->setApiKey($apiKey);

              // example creating a new lead
              try {
              $response = $client->request(
              'PUT ',
              'CurrencyRate ',
              ['VES' => 1.19]
              );

              } catch (\Exception $e) {
              $errorCode = $e->getCode();
              echo "#".$errorCode."#";
              }

              ?>

              Comment


              • #22
                I found an easy way to update rates.
                Get rates from ECB at URL

                ​and then create flow in make.com to fetch the rates and call EspoCRM API.

                Comment

                Working...
                X