Skip to content

Instantly share code, notes, and snippets.

@hc2p
Last active August 8, 2017 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hc2p/b3df72446737878fa44c2046c6d35b39 to your computer and use it in GitHub Desktop.
Save hc2p/b3df72446737878fa44c2046c6d35b39 to your computer and use it in GitHub Desktop.
Importing a big dataset in bulk
{
"swagger": "2.0",
"info": {
"title": "POI API V0.1",
"version": "v0.1"
},
"host": "api.heybertha.de",
"securityDefinitions": {
"Bearer": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"paths": {
"/poi/{dataset_id}/upload-jobs": {
"post": {
"summary": "Importing a big dataset in bulk",
"tags": [
"Data Import (async)"
],
"consumes": [
"multipart/form-data"
],
"security": [
{
"Bearer": []
}
],
"parameters": [
{
"name": "file",
"in": "formData",
"type": "file",
"required": true,
"description": "The file to upload. Max size 500kb."
},
{
"name": "dataset_id",
"in": "path",
"type": "string",
"required": true,
"description": "A unique identifier for the uploaded dataset's format."
}
],
"responses": {
"201": {
"description": "import job created.",
"schema": {
"$ref": "#/definitions/job_status"
},
"examples": {
"application/json": {
"status": "pending",
"id": "import_job_0000000000000001"
}
}
}
}
}
},
"/poi/{dataset_id}/uploads-jobs/{job_id}": {
"get": {
"summary": "Get status of a previously started job.",
"tags": [
"Data Import (async)"
],
"security": [
{
"Bearer": []
}
],
"parameters": [
{
"in": "path",
"name": "dataset_id",
"required": true
},
{
"in": "path",
"description": "Numeric ID of the job to get",
"name": "job_id",
"required": true
}
],
"responses": {
"200": {
"description": "Job status successfully returned.",
"schema": {
"$ref": "#/definitions/job_status"
},
"examples": {
"application/json": {
"status": "done",
"id": "import_job_0000000000000001"
}
}
}
}
}
},
"/poi/{dataset_id}": {
"post": {
"summary": "Creating a new data point",
"tags": [
"Data Import"
],
"consumes": [
"application/json"
],
"security": [
{
"Bearer": []
}
],
"parameters": [
{
"name": "dataset_id",
"in": "path",
"type": "string",
"required": true,
"description": "Unique identifier for the uploaded dataset's format."
},
{
"name": "poi",
"in": "body",
"type": "object",
"required": true,
"description": "The data to create the resource.",
"schema": {
"$ref": "#/definitions/car_service"
}
}
],
"responses": {
"201": {
"description": "poi datapoint created."
}
}
}
},
"/poi/{dataset_id}/{id}": {
"put": {
"summary": "Updating an existing data point",
"tags": [
"Data Import"
],
"consumes": [
"application/json"
],
"security": [
{
"Bearer": []
}
],
"parameters": [
{
"name": "dataset_id",
"in": "path",
"type": "string",
"required": true,
"description": "Unique identifier for the uploaded dataset's format."
},
{
"name": "id",
"in": "path",
"type": "string",
"required": true,
"description": "Unique identifier of the resource to update."
},
{
"name": "poi",
"in": "body",
"type": "object",
"required": true,
"schema": {
"$ref": "#/definitions/car_service"
},
"description": "The data to update on the resource."
}
],
"responses": {
"201": {
"description": "poi datapoint updated."
}
}
}
}
},
"definitions": {
"car_service": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "string"
}
}
},
"job_status": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"pending",
"done",
"failed"
]
},
"id": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment