Skip to main content
Solved

New Line to an Inquiry Form via API

  • February 28, 2025
  • 2 replies
  • 19 views

abrunner78
Jr Varsity III
Forum|alt.badge.img

My company has just deployed Acumatica to our Mexico branch. We noticed the exchange rate pulled from Open Exchange doesn’t match the MX governments (DOF). To resolve this we are going to use Zapier and some Python to pull the exchange rate from the DOF’s website and apply it in Acumatica
(Currency Rate (CM301000)).

I have worked through adding Currency Rate and it’s details screen to an endpoint. With the following bit of code can get the list of currencies and their exchange rates.

Code:

cury = {
    'ToCurrency':{'value': 'USD'},
    'EffectiveDate':{'value': '2025-02-28T00:00:00'}  
}

endpoint = 'https://tormach.acumatica.com/entity/Magento/22.200.001/CurrencyRate?$expand=Details'
req = session.put(endpoint, json=cury)
print(json.dumps(req.json(), indent=2))

Output:

"id": "cc39eca5-673b-444e-a080-8e548c6d80fa",
  "rowNumber": 1,
  "note": null,
  "Details": [
    {
      "id": "e2782637-564c-4cbd-8efd-bfcabea7fdc8",
      "rowNumber": 1,
      "note": {
        "value": ""
      },
      "CurrencyEffectiveDate": {
        "value": "2025-02-28T00:00:00+00:00"
      },
      "CurrencyRate": {
        "value": 1.444058
      },
      "CurrencyRateType": {
        "value": "SPOT"
      },
      "CuryRateID": {
        "value": 15902
      },
      "FromCurrency": {
        "value": "CAD"
      },
      "MultDiv": {
        "value": "Divide"
      },
      "RateReciprocal": {
        "value": 0.69249296
      },
      "custom": {},
      "_links": {
        "files:put": "/entity/Magento/22.200.001/files/PX.Objects.CM.CuryRateMaint/CuryRateRecordsEntry/e2782637-564c-4cbd-8efd-bfcabea7fdc8/{filename}"
      }
    },
    {
      "id": "4777c353-8ce3-4856-bec4-909a1a1fb275",
      "rowNumber": 2,
      "note": {
        "value": ""
      },
      "CurrencyEffectiveDate": {
        "value": "2025-02-28T00:00:00+00:00"
      },
      "CurrencyRate": {
        "value": 7.2875
      },
      "CurrencyRateType": {
        "value": "SPOT"
      },
      "CuryRateID": {
        "value": 15903
      },
      "FromCurrency": {
        "value": "CNY"
      },
      "MultDiv": {
        "value": "Divide"
      },
      "RateReciprocal": {
        "value": 0.13722127
      },
      "custom": {},
      "_links": {
        "files:put": "/entity/Magento/22.200.001/files/PX.Objects.CM.CuryRateMaint/CuryRateRecordsEntry/4777c353-8ce3-4856-bec4-909a1a1fb275/{filename}"
      }
    },
    {
      "id": "e86a588d-0a49-4e2e-ad00-3eb281e5f30d",
      "rowNumber": 3,
      "note": {
        "value": ""
      },
      "CurrencyEffectiveDate": {
        "value": "2025-02-28T00:00:00+00:00"
      },
      "CurrencyRate": {
        "value": 32.922999
      },
      "CurrencyRateType": {
        "value": "SPOT"
      },
      "CuryRateID": {
        "value": 15905
      },
      "FromCurrency": {
        "value": "TWD"
      },
      "MultDiv": {
        "value": "Divide"
      },
      "RateReciprocal": {
        "value": 0.0303739
      },
      "custom": {},
      "_links": {
        "files:put": "/entity/Magento/22.200.001/files/PX.Objects.CM.CuryRateMaint/CuryRateRecordsEntry/e86a588d-0a49-4e2e-ad00-3eb281e5f30d/{filename}"
      }
    }
  ],
  "EffectiveDate": {
    "value": "2025-02-28T00:00:00+00:00"
  },
  "ToCurrency": {
    "value": "USD"
  },
  "custom": {}
}

This is where my problem comes in, how do I add a new line (currency and exchange rate)? Currency Rate is an inquire form and works different and I haven’t had success.

  

Best answer by Dmitrii Naumov

@abrunner78 it should be pretty straight forward, as far as I can tell. 

I think you just need to send body like that

{
  "Details": [
    {
      "CurrencyEffectiveDate": {
        "value": "2025-02-28T00:00:00+00:00"
      },
      "CurrencyRate": {
        "value": [NEW RATE HERE]
      },
      "CurrencyRateType": {
        "value": "SPOT"
      },
      "FromCurrency": {
        "value": "[Your Currency]"
      },
      "MultDiv": {
        "value": "Divide"
      }
    }
  ],
  "EffectiveDate": {
    "value": "2025-02-28T00:00:00+00:00"
  },
  "ToCurrency": {
    "value": "USD"
  }
}

 

View original
Did this topic help you find an answer to your question?

2 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 632 replies
  • Answer
  • March 3, 2025

@abrunner78 it should be pretty straight forward, as far as I can tell. 

I think you just need to send body like that

{
  "Details": [
    {
      "CurrencyEffectiveDate": {
        "value": "2025-02-28T00:00:00+00:00"
      },
      "CurrencyRate": {
        "value": [NEW RATE HERE]
      },
      "CurrencyRateType": {
        "value": "SPOT"
      },
      "FromCurrency": {
        "value": "[Your Currency]"
      },
      "MultDiv": {
        "value": "Divide"
      }
    }
  ],
  "EffectiveDate": {
    "value": "2025-02-28T00:00:00+00:00"
  },
  "ToCurrency": {
    "value": "USD"
  }
}

 


abrunner78
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 40 replies
  • March 3, 2025

@Dmitrii Naumov that was it!

I swear I was trying that but I might have been trying to put it to the `$expand=Details` rather than the top-level. 

Thanks for the help! 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings