(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:

NameDescriptionTypeRequiredPossible values
maxLimits the number of resources requested to return.Integerno 
offsetTells where to start returning records from the entire set of results.Integerno 
orderOrders ascending or descending.Integernoasc,desc
sortOrders the results by the specified field.Stringno 

The max parameter is set to 100 by default.

Filters parameters:

NameDescriptionTypeRequiredExample values
dateCreated_gtFilters by the resource's creation date time and operator greater thanDateno2016-08-15T14:52:48Z
dateCreated_gteFilters by the resource's creation date time and operator greater than or equalDateno 
dateCreated_ltFilters by the resource's creation date time and operator less thanDateno 
dateCreated_lteFilters by the resource's creation date time and operator less than or equalDateno 
lastUpdated_gtFilters by the resource's last-modified date time and operator greater thanDateno 
lastUpdated_gteFilters by the resource's last-modified date time and operator greater than or equalDateno 
lastUpdated_ltFilters by the resource's last-modified date time and operator less thanDateno 
lastUpdated_lteFilters by the resource's last-modified date time and operator less than or equalDateno 
exchangeToSearch by target currency ISO CodeStringnoEUR

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:

NameDescriptionTypeRequiredExample values
idThe ID of the exchange rateLong/Stringyes1

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:

NameDescriptionTypeRequiredExample values
exchangeToISO code of target currency if useExternalId parameter is equal to true, else id of target currencyString / Longyes 
rate Doubleyes 
useExternalIdBy default, it is set to false.Booleannotrue , 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:

NameDescriptionTypeRequiredExample values
idId of the exchange rate to updateLong/StringYes1, EUR
exchangeToISO code of target currency if useExternalId parameter is equal to true, else id of target currencyString / Longyes 
rate Doubleyes 
useExternalIdBy default, it is set to false.Booleannotrue , 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:

NameDescriptionTypeRequiredExample values
exchangeToISO code of target currency if useExternalId parameter is equal to true, else id of target currencyStringyes 
rate Doubleyes 
useExternalIdBy default, it is set to false.Booleannotrue , 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:

NameDescriptionTypeRequiredExample values
rate Doubleyes 

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:

NameDescriptionTypeRequiredExample values
exchangeToISO code of target currency if useExternalId parameter is equal to true, else id of target currencyStringyes 
rate Doubleyes 

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:

NameDescriptionTypeRequiredExamples values
idId of the exchange rate to deleteLong/StringYes777

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..."
}