(Quick Reference)
34 Currency exchange rates - Reference Documentation
Version: 2.1
34 Currency exchange rates
34.1 List
Service: List of exchange rates
Description: This web service returns the list of exchange rates in JSON format.
URL:
https://BASE_URL/api/VERSION/exchangeRates
Method: GET
Parameters:
Pagination parameters:
Name | Description | Type | Required | Possible values |
---|
max | Limits the number of resources requested to return. | Integer | no | |
offset | Tells where to start returning records from the entire set of results. | Integer | no | |
order | Orders ascending or descending. | Integer | no | asc,desc |
sort | Orders the results by the specified field. | String | no | |
The max
parameter is set to 100
by default.
Filters parameters:
Name | Description | Type | Required | Example values |
---|
dateCreated_gt | Filters by the resource's creation date time and operator greater than | Date | no | 2016-08-15T14:52:48Z |
dateCreated_gte | Filters by the resource's creation date time and operator greater than or equal | Date | no | |
dateCreated_lt | Filters by the resource's creation date time and operator less than | Date | no | |
dateCreated_lte | Filters by the resource's creation date time and operator less than or equal | Date | no | |
lastUpdated_gt | Filters by the resource's last-modified date time and operator greater than | Date | no | |
lastUpdated_gte | Filters by the resource's last-modified date time and operator greater than or equal | Date | no | |
lastUpdated_lt | Filters by the resource's last-modified date time and operator less than | Date | no | |
lastUpdated_lte | Filters by the resource's last-modified date time and operator less than or equal | Date | no | |
exchangeTo | Search by target currency ISO Code | String | no | EUR |
Dates should be formatted as the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ)
Success Output
Success case: response.status=200
{
"paging": {
"total": 3,
"max": 1,
"offset": 0,
"previous": null,
"next": "/api/v2.1/exchangeRates?max=1&offset=1&sort=dateCreated&order=asc"
},
"data": [{
"id": 4,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 6,
"name": "GBP"
},
"rate": 0.85285,
"organization": "company",
"dateCreated": "2017-04-10T13:10:26Z",
"lastUpdated": "2017-04-10T13:10:26Z"
}]
}
Failure Output
Failure case:response.status = 400
{
"error": "invalid_param",
"error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}
{
"error": "invalid_datetime_format",
"error_description": "Invalid datetime filter (not ISO-8601 formatted): [2016-08-1Z]"
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
34.2 Show
Service: Show an exchange rate
Description: Returns the requested exchange rate in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/exchangeRates/{id}
URL with external_id:
https://BASE_URL/api/VERSION/exchangeRates/reference/{id}
The external id corresponding to the target currency (exchangeTo)
Method: GET
Parameters:
Name | Description | Type | Required | Example values |
---|
id | The ID of the exchange rate | Long/String | yes | 1 |
Success Output
Success case: response.status=200
{
"id": 5,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 6,
"name": "GBP"
},
"rate": 0.85285,
"organization": "company",
"dateCreated": "2017-04-10T13:10:47Z",
"lastUpdated": "2017-04-10T13:10:47Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter id you provided is not valid for this request."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The exchange rate with the id 7065 doesn't exist."
}
34.3 Create
Service: Create an exchange rate
Description: Returns the created exchange rate in JSON format when successful. Returns a JSON response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/exchangeRates
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
exchangeTo | ISO code of target currency if useExternalId parameter is equal to true, else id of target currency | String / Long | yes | |
rate | | Double | yes | |
useExternalId | By default, it is set to false. | Boolean | no | true , false |
useExternalId
is post as a parameter, exchangeTo
and rate
are post in JSON body request
Success Output
Success case: response.status=201
{
"id": 12,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 1,
"name": "USD"
},
"rate": 1.10135,
"organization": "company",
"dateCreated": "2017-05-16T10:00:54Z",
"lastUpdated": "2017-05-16T10:00:54Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter rate you provided is not valid for this request."
}
{
"error": "already_assigned",
"error_description": "EUR is already assigned to EUR."
}
{
"error": "already_assigned",
"error_description": "USD is already assigned to Exchange Rate List."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The Currency with the id 10000 doesn't exist."
}
{
"error": "not_found",
"error_description": "The Currency with the reference EURO doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
34.4 Update
Service: Update an exchange rate
Description: Returns the updated exchange rate in JSON format when successful. Returns a JSON response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/exchangeRates/{id}
URL with external_id:
https://BASE_URL/api/VERSION/exchangeRates/reference/{id}
The external id corresponding to the target currency (exchangeTo)
Method: PUT
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
id | Id of the exchange rate to update | Long/String | Yes | 1, EUR |
exchangeTo | ISO code of target currency if useExternalId parameter is equal to true, else id of target currency | String / Long | yes | |
rate | | Double | yes | |
useExternalId | By default, it is set to false. | Boolean | no | true , false |
useExternalId
is post as a parameter, exchangeTo
and rate
are post in JSON body request
Success Output
Success case: response.status=200
{
"id": 5,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 6,
"name": "GBP"
},
"rate": 0.856891234,
"organization": "company",
"dateCreated": "2017-04-10T13:10:47Z",
"lastUpdated": "2017-05-16T10:19:53Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter rate you provided is not valid for this request."
}
{
"error": "already_assigned",
"error_description": "EUR is already assigned to EUR."
}
{
"error": "already_assigned",
"error_description": "USD is already assigned to Exchange Rate List."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The Currency with the id 10000 doesn't exist."
}
{
"error": "not_found",
"error_description": "The Currency with the reference EURO doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
Service: Create an exchange rate
Description: Returns the created exchange rate in JSON format when successful. Returns a JSON response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/exchangeRates
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
exchangeTo | ISO code of target currency if useExternalId parameter is equal to true, else id of target currency | String | yes | |
rate | | Double | yes | |
useExternalId | By default, it is set to false. | Boolean | no | true , false |
useExternalId
is post as a parameter, exchangeTo
and rate
are post in JSON body request
Success Output
Success case: response.status=200
{
"id": 12,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 1,
"name": "USD"
},
"rate": 1.10135,
"organization": "company",
"dateCreated": "2017-05-16T10:00:54Z",
"lastUpdated": "2017-05-16T10:00:54Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter rate you provided is not valid for this request."
}
{
"error": "already_assigned",
"error_description": "EUR is already assigned to EUR."
}
{
"error": "already_assigned",
"error_description": "USD is already assigned to Exchange Rate List."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The Currency with the id 10000 doesn't exist."
}
{
"error": "not_found",
"error_description": "The Currency with the reference EURO doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
34.5 Upsert
Service: Upsert a exchange rate
Description: This web service is used to insert an exchange rate, if it doesn't exist, else update it.
URL with external_id:
https://BASE_URL/api/VERSION/exchangeRates/reference/{id}
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
rate | | Double | yes | |
useExternalId
is be posted as true
Success Output
Status: 201 Created or 200 OK
{
"id": 5,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 6,
"name": "GBP"
},
"rate": 0.856891234,
"organization": "company",
"dateCreated": "2017-04-10T13:10:47Z",
"lastUpdated": "2017-05-16T10:19:53Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter rate you provided is not valid for this request."
}
{
"error": "already_assigned",
"error_description": "EUR is already assigned to EUR."
}
{
"error": "already_assigned",
"error_description": "USD is already assigned to Exchange Rate List."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The Currency with the id 10000 doesn't exist."
}
{
"error": "not_found",
"error_description": "The Currency with the reference EURO doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
Service: Create an exchange rate
Description: Returns the created exchange rate in JSON format when successful. Returns a JSON response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/exchangeRates
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
exchangeTo | ISO code of target currency if useExternalId parameter is equal to true, else id of target currency | String | yes | |
rate | | Double | yes | |
useExternalId
is post as a parameter, exchangeTo
and rate
are post in JSON body request
Success Output
Success case: response.status=200
{
"id": 12,
"exchangeFrom": {
"id": 2,
"name": "EUR"
},
"exchangeTo": {
"id": 1,
"name": "USD"
},
"rate": 1.10135,
"organization": "company",
"dateCreated": "2017-05-16T10:00:54Z",
"lastUpdated": "2017-05-16T10:00:54Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter rate you provided is not valid for this request."
}
{
"error": "already_assigned",
"error_description": "EUR is already assigned to EUR."
}
{
"error": "already_assigned",
"error_description": "USD is already assigned to Exchange Rate List."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The Currency with the id 10000 doesn't exist."
}
{
"error": "not_found",
"error_description": "The Currency with the reference EURO doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
34.6 Delete
Service: Delete an exchange rate
Description: This web service is used in order to delete an existing exchange rate object from the database
URL:
https://BASE_URL/api/VERSION/exchangeRates/{id}
URL with external_id:
https://BASE_URL/api/VERSION/exchangeRates/reference/{id}
The external id corresponding to the target currency (exchangeTo)
Method: DELETE
Parameters:
Name | Description | Type | Required | Examples values |
---|
id | Id of the exchange rate to delete | Long/String | Yes | 777 |
Success Output
Success case: response.status=200
{
"success": "true",
"success_description": "Instance deleted successfully"
}
Failure Output
Failure case:response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter id you provided is not valid for this request."
}
{
"error": "delete_failed",
"error_description": "Failed to delete instance"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The exchange rate with the id 999 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}