In this topic:

Conversion Intervals

A currency conversion interval is a part of the rate set; therefore, when creating a new interval, indicate the desired rate set as a path parameter. Also, in the payload, indicate the interval when a given currency conversion rate will be valid.

Creating an interval

The start and end dates that you specify should match with the interval type that you selected when creating the rate set. For example, if the interval type is DAILY, the timespan between the start and end dates should be one day.

POST http://example-currency.gotransverse.com/currex/2/rate-sets/{rate_set_id}/intervals

Request

{
  "from_date": "2018-11-29T09:09:53.809Z",
  "to_date": "2018-11-30T09:09:53.809Z"
}

Response

{
  "id": "680",
  "rate_set_id": "698",
  "from_date": "2018-11-29T09:09:53.809Z",
  "to_date": "2018-11-30T09:09:53.809Z",
  "rates": []			
}

Note: When creating a new interval, you also can add conversion rates in the same request.

Adding a conversion rate to the interval

Once you have created a rate set and the interval, specify source and target currencies for conversion as well as the exchange rate to be applied.

Note: When needed, you can override this currency conversion rate.

POST http://example-currency.gotransverse.com/currex/2/rate-sets/{rate_set_id}/intervals/{id}/rates

Request

[
 {
  "source_currency": "USD",
  "to_currency": "EUR",
  "rate": 0.88
 }
]

Response

[
 {
  "id": "1187",
  "source_currency": "USD",
  "to_currency": "EUR",
  "rate": 0.88,
  "override_rate": null
 }
]

Note: As this conversion rate has just been created and hasn’t been overridden, the returned override_rate value is empty.

Editing the currency conversion rate

If you want to update the currency exchange rate for a certain interval, you can do it by overriding the current rate.

Note: When needed, you can edit and delete the overridden rate value.

Override the currency rate

POST http://example-currency.gotransverse.com/currex/2/rate-sets/{rate_set_id}/intervals/{id}/rates/{rate_id}/override

Request

{
  "override_rate": 0.9
}

Response: 200 Success

Edit the overridden value

PUT http://example-currency.gotransverse.com/currex/2/rate-sets/{rate_set_id}/intervals/{id}/rates/{rate_id}/override

Delete the overridden value

DELETE http://example-currency.gotransverse.com/currex/2/rate-sets/{rate_set_id}/intervals/{id}/rates/{rate_id}/override

Now, you can proceed with viewing the history of rate sets.

Top