Last active
August 29, 2015 14:21
-
-
Save AndrewHenderson/44266a14ba8a805d56c9 to your computer and use it in GitHub Desktop.
Proposed Transaction Groups API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieving a TransactionGroup | |
// ------------------------------------------------------ | |
// GET /transactionGroups | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups", | |
"next": "http://chromeriver.com/transactionGroups?page[offset]=2", | |
"last": "http://chromeriver.com/transactionGroups?page[offset]=10" | |
}, | |
"data": [{ | |
"type": "transactionGroups", | |
"id": "1", | |
"attributes": { | |
"title": "Trip to Hawaii", | |
"startDate": "2015-05-01", | |
"endDate": "2015-05-07" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1", | |
"transactions": { | |
"self": "http://chromeriver.com/transactionGroups/1/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/1/transactions", | |
"linkage": [ | |
{ "type": "transactions", "id": "5" }, | |
{ "type": "transactions", "id": "12" } | |
] | |
} | |
} | |
}] | |
} | |
// Retrieving a TransactionGroup with sorting (ascending startDate) | |
// ------------------------------------------------------ | |
// GET /transactionGroups?sort=+startDate,pageSize=2 | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups", | |
"next": "http://chromeriver.com/transactionGroups?page[offset]=2", | |
"last": "http://chromeriver.com/transactionGroups?page[offset]=5" | |
}, | |
"data": [{ | |
"type": "transactionGroups", | |
"id": "1", | |
"attributes": { | |
"title": "Trip to Hawaii", | |
"startDate": "2015-05-01", | |
"endDate": "2015-05-07" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1", | |
"transactions": { | |
"self": "http://chromeriver.com/transactionGroups/1/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/1/transactions", | |
"linkage": [ | |
{ "type": "transactions", "id": "5" }, | |
{ "type": "transactions", "id": "12" } | |
] | |
} | |
} | |
}, | |
{ | |
"type": "transactionGroups", | |
"id": "2", | |
"attributes": { | |
"title": "Trip to Dallas", | |
"startDate": "2015-05-09", | |
"endDate": "2015-05-11" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/2", | |
"transactions": { | |
"self": "http://chromeriver.com/transactionGroups/2/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/2/transactions", | |
"linkage": [ | |
{ "type": "transactions", "id": "23" }, | |
{ "type": "transactions", "id": "27" } | |
] | |
} | |
} | |
} | |
] | |
} | |
// Retrieving a TransactionGroup with Includes | |
// ------------------------------------------------------ | |
// GET /transactionGroups/1?include=transactions&fields[transactions]=amountSpent,createDate | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups", | |
"next": "http://chromeriver.com/transactionGroups?page[offset]=2", | |
"last": "http://chromeriver.com/transactionGroups?page[offset]=10" | |
}, | |
"data": [{ | |
"type": "transactionGroups", | |
"id": "1", | |
"attributes": { | |
"title": "Trip to Hawaii" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1", | |
"transactions": { | |
"self": "http://chromeriver.com/transactionGroups/1/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/1/transactions", | |
"linkage": [ | |
{ "type": "transactions", "id": "5" }, | |
{ "type": "transactions", "id": "12" } | |
] | |
} | |
} | |
}], | |
"included": [{ | |
"type": "transactions", | |
"id": "5", | |
"attributes": { | |
"amountSpent": 200, | |
"createDate": "2015-05-03" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/5" | |
} | |
}, { | |
"type": "transactions", | |
"id": "12", | |
"attributes": { | |
"amountSpent": 43.40, | |
"createDate": "2015-05-06" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/12" | |
} | |
}] | |
} | |
// Updating the Transactions within a TransactionGroup | |
// ------------------------------------------------------ | |
// PATCH /transactionGroups/1/links/transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"data": [ | |
{"type": "transactions", "id": "5"}, | |
{"type": "transactions", "id": "12"}, | |
{"type": "transactions", "id": "18"} | |
] | |
} | |
// Adding a Transaction to a TransactionGroup | |
// ------------------------------------------------------ | |
// POST /transactionGroups/1/links/transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"data": [ | |
{"type": "transactions", "id": "18"} | |
] | |
} | |
// Removing a Transaction to a TransactionGroup | |
// ------------------------------------------------------ | |
// DELETE /transactionGroups/1/links/transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"data": [ | |
{"type": "transactions", "id": "12"}, | |
{"type": "transactions", "id": "18"} | |
] | |
} | |
// Retrieve Transactions within a TransactionGroup | |
// ------------------------------------------------------ | |
// GET /transactionGroups/1/transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1/transactions", | |
"next": "http://chromeriver.com//transactionGroups/1/transactions?page[offset]=2", | |
"last": "http://chromeriver.com/transactionGroups?page[offset]=3" | |
}, | |
"data": [{ | |
"type": "transactions", | |
"id": "5", | |
"attributes": { | |
"amountSpent": 200, | |
"createDate": "2015-05-03" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/5" | |
} | |
] | |
} | |
// Retrieve Transactions Relationship Data within a TransactionGroup | |
// ------------------------------------------------------ | |
// GET /transactionGroups/1/links/transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/1/transactions" | |
}, | |
"data": [ | |
{"type": "transactions", "id": "5"}, | |
{"type": "transactions", "id": "12"}, | |
{"type": "transactions", "id": "18"} | |
] | |
} | |
// Retrieving a TransactionGroup with Includes (Transaction Merge Sets & Transactions) | |
// ------------------------------------------------------ | |
// GET /transactionGroups/1?include=transactionMergeSets,transactions | |
// Content-Type: application/vnd.api+json | |
// Accept: application/vnd.api+json | |
{ | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups" | |
}, | |
"data": [{ | |
"type": "transactionGroups", | |
"id": "1", | |
"attributes": { | |
"title": "Trip to Hawaii" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactionGroups/1", | |
"transactions": { | |
"self": "http://chromeriver.com/transactionGroups/1/links/transactions", | |
"related": "http://chromeriver.com/transactionGroups/1/transactions", | |
"linkage": [ | |
{ "type": "transactionMergeSets", "id": "1" }, | |
{ "type": "transactions", "id": "5" }, | |
{ "type": "transactions", "id": "12" } | |
] | |
} | |
} | |
}], | |
"included": [{ | |
"type" : "transactionMergeSets", | |
"id" : "1", | |
"attributes": { | |
"deletedMergeSet" : false, | |
"primaryTransactionId": "18" | |
}, | |
"links" : { | |
"self": "http://chromeriver.com/transactionMergeSets/1", | |
"links": { | |
"self": "http://chromeriver.com/transactionMergeSets/1/links/transactions", | |
"transactions": { | |
"linkage": [ | |
{ "type": "transactions", "id": "18" }, | |
{ "type": "transactions", "id": "35" } | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"type": "transactions", | |
"id": "5", | |
"attributes": { | |
"amountSpent": 200, | |
"createDate": "2015-05-03" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/5" | |
} | |
}, | |
{ | |
"type": "transactions", | |
"id": "12", | |
"attributes": { | |
"amountSpent": 43.40, | |
"createDate": "2015-05-06" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/12" | |
} | |
}, | |
{ | |
"type": "transactions", | |
"id": "18", | |
"attributes": { | |
"amountSpent": 12.90, | |
"createDate": "2015-05-09" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/18" | |
} | |
}, | |
{ | |
"type": "transactions", | |
"id": "35", | |
"attributes": { | |
"amountSpent": 493.11, | |
"createDate": "2015-05-10" | |
}, | |
"links": { | |
"self": "http://chromeriver.com/transactions/35" | |
} | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment