Skip to content

Instantly share code, notes, and snippets.

@jrep
Created December 18, 2014 20:11
Show Gist options
  • Save jrep/12ec86ba3ad5883d9d38 to your computer and use it in GitHub Desktop.
Save jrep/12ec86ba3ad5883d9d38 to your computer and use it in GitHub Desktop.
Attributes test
snowcrash blueprint.apib
_version: 2.1
metadata:
- name: "FORMAT"
value: "1A"
- name: "HOST"
value: "https://BASE_URL/"
name: "MSON demo"
description: "# Converted to MSON and Attributes\n\nThis is an API.\n\n### GET\n\nConverted to MSON and Attributes\n\n+ Response 200 (application/json)\n\n + Attributes (object)\n + month (number) - The month we want to fetch data for.\n + Values\n + `1`\n + `2`\n + `3`\n + `4`\n + `5`\n + `6`\n + `7`\n + `8`\n + `9`\n + `10`\n + `11`\n + `12`\n + year (number) - The year we want to fetch data for.\n + reportSourceId (string)\n\n The report source ID, as returned by the reportSources service.\n\n + reportSourceType (string)\n\n The report source type, as returned by the reportSources service.\n\n + statisticType (string)\n\n The statistic type identifier, as provided by the statisticTypes service.\n\n + productId (string) ... The ID of the product.\n\n + Body\n\n {\n \"status\": \"ok\",\n \"contents\": {\n \"title\": \"\",\n \"categories\": \"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\",\n \"series\": [\n {\n \"name\": \"NonFinalData\",\n \"color\": \"#f36b28\",\n \"values\": {\n \"1\": 13.39,\n \"2\": 35.59,\n \"3\": 59.584,\n \"4\": 81.368,\n \"5\": 97.119,\n \"6\": 104.47,\n \"7\": 124.338,\n \"8\": 143.238,\n \"9\": 163.415,\n \"10\": 222.385,\n \"11\": 247.204,\n \"12\": 275.131,\n \"13\": 293.759,\n \"14\": 307.987,\n \"15\": 342.186,\n \"16\": 366.525,\n \"17\": 381.929,\n \"18\": 400.502,\n \"19\": 419.108,\n \"20\": 644.331,\n \"21\": 661.764,\n \"22\": 678.774,\n \"23\": 693.848,\n \"24\": 712.568,\n \"25\": 726.205,\n \"26\": 742.338,\n \"27\": 765.065,\n \"28\": 821.818,\n \"29\": 854.806,\n \"30\": 881.275,\n \"31\": null\n },\n \"orderedValues\": \"[13.39,35.59,59.584,81.368,97.119,104.47,124.338,143.238,163.415,222.385,247.204,275.131,293.759,307.987,342.186,366.525,381.929,400.502,419.108,644.331,661.764,678.774,693.848,712.568,726.205,742.338,765.065,821.818,854.806,881.275,0]\"\n }\n ],\n \"labels\": [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", \"29\", \"30\", \"31\"]\n }\n }\n\n"
resourceGroups:
- name:
description:
resources:
- name: "CP Codes"
description:
uriTemplate: "/billing-usage/v1/cpcodes/{reportSourceType}/{reportSourceId}/{month}/{year}"
model:
parameters:
actions:
- name:
description: "Not converted to MSON and Attributes\n\n+ Properties\n + code (string) ... The CP code.\n + description (string) ... CP code description\n\n"
method: "GET"
parameters:
- name: "month"
description: "The month we want to fetch data for."
type: "number"
required: true
default:
example:
values:
- value: "1"
- value: "2"
- value: "3"
- value: "4"
- value: "5"
- value: "6"
- value: "7"
- value: "8"
- value: "9"
- value: "10"
- value: "11"
- value: "12"
- name: "year"
description: "The year we want to fetch data for."
type: "number"
required: true
default:
example:
values:
- name: "reportSourceId"
description: "The report source ID, as returned by the `reportSources` service."
type: "string"
required: true
default:
example:
values:
- name: "reportSourceType"
description: "The report source type, as returned by the `reportSources` service."
type: "string"
required: true
default:
example:
values:
examples:
- name:
description:
requests:
responses:
- name: "200"
description:
headers:
- name: "Content-Type"
value: "application/json"
body: "{\n \"status\": \"ok\",\n \"contents\": [\n {\n \"code\": 1234,\n \"description\": \"Cp code description\"\n },\n {\n \"code\": 2345,\n \"description\": \"Cp code description\"\n }\n ]\n}\n"
schema:
OK.
FORMAT: 1A
HOST: https://BASE_URL/
# MSON demo
# Converted to MSON and Attributes
This is an API.
### GET
Converted to MSON and Attributes
+ Response 200 (application/json)
+ Attributes (object)
+ month (number) - The month we want to fetch data for.
+ Values
+ `1`
+ `2`
+ `3`
+ `4`
+ `5`
+ `6`
+ `7`
+ `8`
+ `9`
+ `10`
+ `11`
+ `12`
+ year (number) - The year we want to fetch data for.
+ reportSourceId (string)
The report source ID, as returned by the reportSources service.
+ reportSourceType (string)
The report source type, as returned by the reportSources service.
+ statisticType (string)
The statistic type identifier, as provided by the statisticTypes service.
+ productId (string) ... The ID of the product.
+ Body
{
"status": "ok",
"contents": {
"title": "",
"categories": "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31",
"series": [
{
"name": "NonFinalData",
"color": "#f36b28",
"values": {
"1": 13.39,
"2": 35.59,
"3": 59.584,
"4": 81.368,
"5": 97.119,
"6": 104.47,
"7": 124.338,
"8": 143.238,
"9": 163.415,
"10": 222.385,
"11": 247.204,
"12": 275.131,
"13": 293.759,
"14": 307.987,
"15": 342.186,
"16": 366.525,
"17": 381.929,
"18": 400.502,
"19": 419.108,
"20": 644.331,
"21": 661.764,
"22": 678.774,
"23": 693.848,
"24": 712.568,
"25": 726.205,
"26": 742.338,
"27": 765.065,
"28": 821.818,
"29": 854.806,
"30": 881.275,
"31": null
},
"orderedValues": "[13.39,35.59,59.584,81.368,97.119,104.47,124.338,143.238,163.415,222.385,247.204,275.131,293.759,307.987,342.186,366.525,381.929,400.502,419.108,644.331,661.764,678.774,693.848,712.568,726.205,742.338,765.065,821.818,854.806,881.275,0]"
}
],
"labels": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"]
}
}
## CP Codes [/billing-usage/v1/cpcodes/{reportSourceType}/{reportSourceId}/{month}/{year}]
### GET
Not converted to MSON and Attributes
+ Properties
+ code (string) ... The CP code.
+ description (string) ... CP code description
+ Parameters
+ month (number) ... The month we want to fetch data for.
+ Values
+ `1`
+ `2`
+ `3`
+ `4`
+ `5`
+ `6`
+ `7`
+ `8`
+ `9`
+ `10`
+ `11`
+ `12`
+ year (number) ... The year we want to fetch data for.
+ reportSourceId (string) ... The report source ID, as returned by the `reportSources` service.
+ reportSourceType (string) ... The report source type, as returned by the `reportSources` service.
+ Response 200 (application/json)
{
"status": "ok",
"contents": [
{
"code": 1234,
"description": "Cp code description"
},
{
"code": 2345,
"description": "Cp code description"
}
]
}
The two GETs have very similar bodies. One is "Converted to MSON" the other not. Both are "OK". Their ASTs are very different.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment