This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <api xmlns="http://mashape.com" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://mashape.com http://mashape.com/schema/mashape-api-3.0.xsd"> | |
| <method name="Get User" http="GET"> | |
| <url><![CDATA[/users/{id}]]></url> | |
| <parameters> | |
| <parameter optional="false">id</parameter> | |
| </parameters> |
This file contains hidden or 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
| { | |
| "name": "Mark", | |
| "email": "[email protected]" | |
| } |
This file contains hidden or 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
| { | |
| "code": 1, | |
| "message": "The user does not exist" | |
| } |
This file contains hidden or 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
| <api format="JSON"> | |
| <authentication type="header"> | |
| <description><![CDATA[This is a simple header authentication]]></description> | |
| <authenticationParameters> | |
| <authenticationParameter name="X-Pippo-Username"> | |
| <description><![CDATA[Please enter here your username]]></description> | |
| </authenticationParameter> | |
| <authenticationParameter name="X-Pippo-Password"> | |
| <description><![CDATA[Please enter here your password]]></description> |
This file contains hidden or 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
| // Pseudo-code | |
| HASH = BASE64(PUBLIC_KEY + ":" + HMAC_SHA1(UUID, PRIVATE_KEY) + UUID) |
This file contains hidden or 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
| private void main() { | |
| Long value = null; | |
| if (value != null) { | |
| printValue(value); | |
| } | |
| } | |
| private void printValue(Long value) { | |
| System.out.println(value.toString()); | |
| } |
This file contains hidden or 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
| private void main() { | |
| Long value = null; | |
| printValue(value); | |
| } | |
| private void printValue(Long value) { | |
| if (value != null) { | |
| System.out.println(value.toString()); | |
| } | |
| } |
This file contains hidden or 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
| // Put the "header" value into a "X-Mashape-Authorization" header before making the HTTP request | |
| // Util functions to generate a HMAC_SHA1 hash and Base64 encode a value | |
| private static String hmac_sha1(String publicKey, String privateKey) { | |
| System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); | |
| byte[] privateKeyBytes = encoding.GetBytes(privateKey); | |
| byte[] publicKeyBytes = encoding.GetBytes(publicKey); |
This file contains hidden or 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
| Iterable<Transaction> fetchAll = DAOFactory.getInstance().getTransactionDAO().fetchAll(); | |
| for (Iterator<Transaction> iterator = fetchAll.iterator(); iterator | |
| .hasNext();) { | |
| Transaction transaction = iterator.next(); | |
| LOG.info("Processing transaction: " + transaction.getId()); | |
| Subscription subscription = transaction.getSubscription(); | |
| if (subscription == null) { | |
| LOG.error("Missing subscription for transaction: " + transaction.getId()); | |
| } else { | |
This file contains hidden or 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
| > db.subscriptions.find({"_id":ObjectId("4ed3f9b2d7fe63a70e1db113")}, {transactions:1}) | |
| { "_id" : ObjectId("4ed3f9b2d7fe63a70e1db113"), "transactions" : [ { | |
| "$ref" : "transactions", | |
| "$id" : ObjectId("4f09ba1be4b0c4954881f4fc") | |
| } ] } | |
| > db.subscriptions.find({"_id":ObjectId("4ed3f9b2d7fe63a70e1db113")}, {transactions:1}) | |
| { "_id" : ObjectId("4ed3f9b2d7fe63a70e1db113"), "transactions" : [ { | |
| "$ref" : "transactions", | |
| "$id" : ObjectId("4f09ba1be4b0c4954881f4fc") |