Using web api to load currency rates

Hi,

I am having problems loading currency rates through the webapi.

I am using v2019.1 on premises to load currency rates into company EURPAY. The following  code using PHP and cURL is as follows:

endpoint: "">localhost/.../CSCurrencyRates";

The payload is 

{
"ToCurrency": "EUR",
"RateType": "SP",
"DateMatching": "Earlier",
"RateOperation": "Multiply",
"PropagateChangesImmediately": true,
"Command": "PropagateDateRange",
"FromDate": "2019-06-18T01:00:00.149Z",
"ToDate": "2019-06-18T23:00:00.149Z",
"CurrencyRateDetail": [
{
"ToCurrency": "EUR",
"RateType": "SP",
"FromCurrency": "USD",
"RateDate": "2019-06-18T01:00:00.149Z",
"Rate": 1.1187,
"Spread": 0,
"DateMatching": "Earlier",
"RateOperation": "Multiply",
"PropagateChangesImmediately": true,
"UpdateOperation": "Unspecified"
}
],
"UpdateOperation": "Unspecified"
}
}
}

The response is:

{
"error": {
"code": "RecordInvalid",
"message": {
"lang": "en-US",
"value": "The currency code cannot be blank. The rate type cannot be blank."
}

When run in SWAGGER (POST) it adds the record in the company database (CSCRD table) but not in the system database table. Initially, I thought this was because of "UpdateOperation": "Unspecified" - however, trying an "Insert" makes no difference.

In this case the response is: "duplicate record/already exists", although it adds the record to the company database table CSCRD.

Does anybody have any ideas?

Thanks

Marios

 

Parents Reply Children
No Data