# Currency convert

REST API, Service version 1.0.0

> API reference: [`GET /currency/1.0/convert`](https://benomad.com/dev/doc/bemap-api/api/map-context/currency-convert-get.md), [`POST /currency/1.0/convert`](https://benomad.com/dev/doc/bemap-api/api/map-context/currency-convert-post.md)

Convert a currency to another.

## Summary
1. Request
 1. Mandatory parameters
2. Response
 1. Details of fields
 2. Response samples

## Request
The request can be sent with both `GET` and `POST` methods of HTTP.
For the `POST` method, the request must be sent with the HTTP header `Content-Type` set to `application/json`. 

Sample:
URI: `/bgis/service/currency/1.0/convert`

POST data:
```javascript
{
  "from": "EUR",
  "value": 1000,
  "to": "MAD"
}
```

GET data:

```
`/bgis/service/currency/1.0/convert?from=FJD&value=1.0&to=USD`
```

### __Parameters__

- `from` (string, required): The currency to convert from
- `value` (number (float), required): The amount to of the from currency to be converted
- `to` (string, required): The currency to convert from
- `geoserver` (string): Geoserver name.
- `swidx` (integer (int32), deprecated): Switch index.

## Response
Return the converted value amount.

### Details of fields

#### __lastUpdate__: time stamp of data will be updated.

#### __value__: converted value amount.

### Response samples

JSON Sample:
```
{
  "lastUpdate": 1670507755480,
  "value": 11096.038
}
```
