Created
November 29, 2015 19:18
-
-
Save brycemcd/3001a8dd3e57408f043f to your computer and use it in GitHub Desktop.
Creating Avro schema for Citibike Data
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
#!/bin/bash | |
# NOTE: this is the readable version. Escape quotes and remove new lines prior to submitting | |
curl -X POST -H 'Content-Type: application/vnd.schemaregistry.v1+json' -d '{ | |
"type": "record", | |
"name": "citibike", | |
"fields" : [ | |
{ "name": "executionTime", "type": "string"}, | |
{ "name": "stationBeanList", "type": { | |
"type" : "array", | |
"items" : { | |
"name" : "stationBeanList", | |
"type" : "record", | |
"fields" : [ | |
{ "name" : "id", "type" : "int"}, | |
{ "name": "stationName", "type": "string"}, | |
{ "name": "availableDocks", "type": "int"}, | |
{ "name": "totalDocks", "type": "int"}, | |
{ "name": "latitude", "type": "double"}, | |
{ "name": "longitude", "type": "double"}, | |
{ "name":"statusValue", "type": "string"}, | |
{ "name": "statusKey", "type": "int"}, | |
{ "name": "availableBikes", "type": "int"}, | |
{ "name": "stAddress1", "type": "string"}, | |
{ "name": "stAddress2", "type": "string"}, | |
{ "name": "city", "type": "string"}, | |
{ "name": "postalCode", "type": "string"}, | |
{ "name": "location", "type": "string"}, | |
{ "name": "altitude", "type": "string"}, | |
{ "name": "testStation", "type": "boolean"}, | |
{ "name": "lastCommunicationTime", "type": "string"}, | |
{ "name": "landMark", "type": "string"} | |
] | |
} | |
} | |
} | |
] | |
}' localhost:8081/subjects/citibike/versions |
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
#!/bin/bash | |
# when submitting, double quotes should be escaped and new lines removed | |
curl -X POST -H 'Content-Type: application/vnd.schemaregistry.v1+json' -d '{"schema" : "{ \"type\": \"record\", \"name\": \"citibike\", \"fields\" : [ { \"name\": \"executionTime\", \"type\": \"string\"}, { \"name\": \"stationBeanList\", \"type\": { \"type\" : \"array\", \"items\" : { \"name\" : \"stationBeanList\", \"type\" : \"record\", \"fields\" : [ { \"name\" : \"id\", \"type\" : \"int\"}, { \"name\": \"stationName\", \"type\": \"string\"}, { \"name\": \"availableDocks\", \"type\": \"int\"}, { \"name\": \"totalDocks\", \"type\": \"int\"}, { \"name\": \"latitude\", \"type\": \"double\"}, { \"name\": \"longitude\", \"type\": \"double\"}, { \"name\":\"statusValue\", \"type\": \"string\"}, { \"name\": \"statusKey\", \"type\": \"int\"}, { \"name\": \"availableBikes\", \"type\": \"int\"}, { \"name\": \"stAddress1\", \"type\": \"string\"}, { \"name\": \"stAddress2\", \"type\": \"string\"}, { \"name\": \"city\", \"type\": \"string\"}, { \"name\": \"postalCode\", \"type\": \"string\"}, { \"name\": \"location\", \"type\": \"string\"}, { \"name\": \"altitude\", \"type\": \"string\"}, { \"name\": \"testStation\", \"type\": \"boolean\"}, { \"name\": \"lastCommunicationTime\", \"type\": \"string\"}, { \"name\": \"landMark\", \"type\": \"string\"} ] } } } ]}"}' http://localhost:8081/subjects/citibike/versions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment