Create a gist now

Instantly share code, notes, and snippets.

Runscope Azure Storage API Table Query
{
"trigger_url": "https://api.runscope.com/radar/fcb31ec5-f6ac-43a4-ac7c-999999999999/trigger",
"name": "Azure Storage",
"version": "1.0",
"exported_at": 1485287745,
"steps": [
{
"url": "https://{{accountName}}.table.core.windows.net/{{tableName}}(PartitionKey='12345',RowKey='678910')",
"variables": [],
"args": {},
"step_type": "request",
"auth": {},
"note": "",
"headers": {},
"assertions": [
{
"comparison": "equal_number",
"value": 200,
"source": "response_status"
}
],
"scripts": [],
"fragment": "",
"before_scripts": [
"var storageAccount = variables.get(\"accountName\");\r\nvar accountKey = variables.get(\"accountKey\");\r\nvar date = moment().format(\"ddd, DD MMM YYYY HH:mm:ss\");\r\nvar data = date + \"\\n\" +\r\n \"/\" + storageAccount + \" /\" + variables.get(\"tableName\")\r\n// utf-8 encoding\r\nvar encodedData = unescape(encodeURIComponent(data));\r\n// encrypt and encode the data\r\nvar hash = CryptoJS.HmacSHA256(encodedData, variables.get(\"accountKey\"));\r\nvar signature = hash.toString(CryptoJS.enc.Base64);\r\n// build the auth header \r\nvar auth = \"SharedKeyLite \" + variables.get(\"accountName\") + \":\" + signature;\r\n// add the headers to the request\r\nrequest.headers[\"Authorization\"] = auth;\r\nrequest.headers[\"Date\"] = date;"
],
"data": "",
"method": "GET"
}
],
"description": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment