Skip to content

Instantly share code, notes, and snippets.

@joshrosso
Created June 16, 2014 23:34
Show Gist options
  • Save joshrosso/73b8190d6ec8f2d87b7d to your computer and use it in GitHub Desktop.
Save joshrosso/73b8190d6ec8f2d87b7d to your computer and use it in GitHub Desktop.
bank.raml
#%RAML 0.8
title: Samuel's Banking API
version: v0.1
#baseUri: http://www.placeholder.com/api/{version}
baseUri: http://mocksvc.mulesoft.com/mocks/9d532d8f-bea1-47d3-a4f2-ccc36b193036/api/{version}
mediaType: application/json
securitySchemes:
- oauth_2: !include security_schemes.raml
traits:
- paged: !include paged.raml
- secured:
headers:
Authentication:
required: true
description: Custom authentication token
example: EGARyhqw54345EGARyhqw54345EGARyhqw54345EGARyhqw54345
responses:
403:
description: You can't perform this operation, sorry!
schemas:
- customer: |
{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema",
"id": "http://jsonschema.net",
"required": true,
"customer": {
"firstName": {
"type": "string",
"required": true
},
"customer": {
"firstName": {
"type": "string",
"required": true
},
"lastname": {
"type": "string",
"required": true
},
"email": {
"type": "string",
"required": true
}
}
}
}
- account: |
{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema",
"id": "http://jsonschema.net",
"required": true,
"account": {
"accountType": {
"type": "string",
"required": true
},
"expirationDate": {
"type": "string",
"required": true
}
}
}
- transfer: |
{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema",
"id": "http://jsonschema.net",
"required": true,
"account": {
"amount": {
"type": "string",
"required": true
},
"targetAccount": {
"type": "string",
"required": true
},
"dateScheduled": {
"type": "string",
"required": true
}
}
}
resourceTypes:
- collection:
get:
responses:
200:
body:
schema: <<schemaParameter>>
/customers:
securedBy: [ oauth_2 ]
displayName: Customers
is: [ secured ]
type: { collection: { schemaParameter: customer } }
get:
description: Retrieve a full list of customers
is: [ paged ]
responses:
200:
body:
example: |
[
{
"customerID": "ah3d8ajd",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1984-03-22"
},
{
"customerID": "ah389d8",
"firstName": "Mary",
"lastName": "Wellington",
"dateOfBirth": "1990-03-22"
},
{
"customerID": "dkd8j3s",
"firstName": "Beverly",
"lastName": "Soda",
"dateOfBirth": "1980-03-22"
}
]
post:
description: Add a customer to the bank
body:
schema: customer
/{customerId}:
is: [ secured ]
put:
description: Replace a Customer's Info
/accounts:
is: [ secured ]
post:
is: [ secured ]
description: Add an account to a customer
body:
schema: account
get:
description: Get a list of accounts belonging to a particulat customer
responses:
200:
body:
example: |
[
{
"accountID": "38abe83sd",
"balance": "3000.57",
"creationDate": "2010-03-22",
"status": "open"
},
{
"accountID": "494sjs9a",
"balance": "2456.98",
"creationDate": "2011-03-22",
"status": "closed"
},
{
"accountID": "38j29ej2s",
"balance": "3843.57",
"creationDate": "2012-03-22",
"status": "suspended"
}
]
/{accountId}:
is: [ secured ]
put:
description: Update Bank Account Info
delete:
description: Remove an account from a customer
get:
description: Retrieve a detailed account
responses:
200:
body:
example: |
{
"balance": "3000.57",
"creationDate": "2010-03-22",
"status": "open"
}
/transfers:
is: [ secured ]
get:
description: Retrieve a list of all transfers
queryParameters:
type:
description: Specify outbound/inbound transfer
displayName: Incoming or Outgoing request
is: [ paged ]
responses:
200:
body:
example: |
[
{
"transferID": "abdi28r9",
"transferAmounts": "3499.39",
"transferType": "outbound",
"targetAccount": "a938djd",
"transferDate": "2010-07-12"
},
{
"transferID": "83jd8sjs",
"transferAmounts": "3499.39",
"transferType": "outbound",
"targetAccount": "dfj39s",
"transferDate": "2010-02-12"
},
{
"transferID": "ak3j1",
"transferAmounts": "349.39",
"transferType": "inbound",
"targetAccount": "3od9w",
"transferDate": "2011-07-12"
}
]
post:
description: Create a transfer
body:
schema: transfer
/{transferId}:
is: [ secured ]
get:
description: Retrieve details on a particular transfer
responses:
200:
body:
example: |
{
"transferAmounts": "3499.39",
"transferType": "outbound",
"targetAccount": "a938djd",
"transferDate": "2010-07-12"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment