Medici Bank API
Medici Bank API

Standard Data Structures

Below are a list of standards that we enforce for our data structures.

Content-Type

Content-type: application/json

Any content request (even if valid) that is not application/json will a return a 415 Unsupported Media Type HTTP status code.

Timestamps

All timestamps are returned in ISO 8601 format:

YYYY-MM-DDTHH:MM:SSZ

Idempotent Requests

An Idempotent Request is a request that may change the state of the resource once, but will not continue to change if that identical request is sent again.

For example, a PUT request will update some (or all) of the information on a resource, based on what is being asked to be changed. But once the resource has been changed, sending in another request, that is identical to the first request, will not result in anything changing. Because no new information was changed.

This is the same for DELETE requests. Once a resource is deleted, it can not be re-deleted.

Standard Response Structure

An Array of Data

Response 200 (application/json)

{
	"total":2,
	"data": [
		{"field":"value1"},
		{"field":"value2"}
	],
	"url":"the URL used in the API call",
	"status":"The HTTP Status Code",
	"timestamp":"the timestamp of the API call",
	"links": {
		"first":"link to the first available paginated resource",
		"next":"link to next available paginated resource",
		"prev":"link to previously available paginated resource",
		"last":"link to the last available paginated resource"
		}
}

Single Data Object

Response 200 (application/json)

{
	"total": 1,
	"data": {
		"field":"value" 
	},
	"url":"the URL used in the API call",
	"status":"The HTTP Status Code",
	"timestamp":"the timestamp of the API call"
}

Example Error Response

Response 404 (application/json)

{
	"errorStatus":400,
	"errorMessage": "Bad Request",
	"errorDescription: "The request you sent in is missing required information."
}

Please note: the “links” and “total” fields are not used when errors are returned

Sorting and Filtering

Every API result that produces a collection of data can be manually sorted and/or filtered. By default, collections of data are sorted by the createdAt timetsamp DESC. This means the newest record in that data collection is first on the list (and the oldest is last).

Sorting

You can dictate sorting by passing the sort= parameter in any route and detailing the field (or fields) by which you’d like to sort.

/example?sort=['name':'ASC']

Filtering

Limit

To manually increase this number, use the limit= parameter. For example, to return 40 records per page, you would do the following:

/example/?limit=40

Skip

Every API result that produces a collection of data is automatically paginated. The default number of records per page is 25. By default, no returned results are skipped. To mimic the aspect of ‘pages’, use the skip= parameter to skip over a specified number of returned results.

/example/?skip=20 (would return results from 21 and higher, based on the current limit per page.)

You are now ready to start using our API. We look forward to seeing what great financial applications you will be able to create with us and we appreciate your business.

Medici Bank International © 2019. All Rights Reserved.