Skip to content

Instantly share code, notes, and snippets.

@cbfrance
Last active February 3, 2019 04:04
Show Gist options
  • Save cbfrance/707b05ca94474d94a2591216597bcfc1 to your computer and use it in GitHub Desktop.
Save cbfrance/707b05ca94474d94a2591216597bcfc1 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
# Layer.City API Spec
servers:
- description: Layer.city API
url: https://api-dev.layer.city
info:
description: Geocoding as it was meant to be - no subscriptions, no maximums, no work.
version: "0.1"
title: layer.city
contact:
email: [email protected]
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: general
description: General operations
- name: geocoding
description: Operations related to geocoding
paths:
/search:
get:
tags:
- general
summary: Query database based on search parameters
description: |
Query database based on search parameters.
parameters:
- in: query
name: country
schema:
type: string
description: Boundary countryof query
- in: query
name: focus.lat
schema:
type: number
description: Number ID of the user to get, corresponding to the Auth0 Id
- in: query
name: focus.lon
schema:
type: number
description: Number ID of the user to get, corresponding to the Auth0 Id
responses:
'200':
description: "200 Response"
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
'400':
description: Bad Request.
'401':
description: Bad Request. Invalid or missing key.
'402':
description: Insufficient Account Balance.
/layers:
get:
tags:
- geocoding
summary: Layer for ROI
description: Provides the layers that contain patches for the given ROI
parameters:
- $ref: '#/components/parameters/ApikeyParam'
- $ref: '#/components/parameters/LatParam'
- $ref: '#/components/parameters/LongParam'
- $ref: '#/components/parameters/BboxLat1Param'
- $ref: '#/components/parameters/BboxLong1Param'
- $ref: '#/components/parameters/BboxLat2Param'
- $ref: '#/components/parameters/BboxLong2Param'
- $ref: '#/components/parameters/LocationParam'
responses:
'200':
description: Ok.
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
# $ref: "#/components/schemas/RoiSchema"
'400':
description: Bad Request. ROI improperly specified.
'401':
description: Bad Request. Invalid or missing key.
/patches:
get:
tags:
- geocoding
summary: abcds
description: |
Provides abcdef
parameters:
- in: query
name: layers
schema:
type: integer
required: true
description: Fetch the patches and layer(s) for the given ROI
- $ref: '#/components/parameters/ApikeyParam'
- $ref: '#/components/parameters/LatParam'
- $ref: '#/components/parameters/LongParam'
- $ref: '#/components/parameters/BboxLat1Param'
- $ref: '#/components/parameters/BboxLong1Param'
- $ref: '#/components/parameters/BboxLat2Param'
- $ref: '#/components/parameters/BboxLong2Param'
- $ref: '#/components/parameters/LocationParam'
responses:
'200':
description: "200 Response"
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
'400':
description: Bad Request. ROI improperly specified.
'401':
description: Bad Request. Invalid or missing key.
/patches/quote:
get:
tags:
- geocoding
summary: Get quote for request
description: |
Provides a quote for a request
parameters:
- in: path
name: userid
schema:
type: integer
required: true
description: Number ID of the user to get, corresponding to the Auth0 Id
responses:
'200':
description: "200 Response"
content:
application/json:
schema:
$ref: "#/components/schemas/QuoteSchema"
'401':
description: Bad Request. Invalid or missing key.
'402':
description: Insufficient balance to get quote.
/patches/order:
get:
tags:
- geocoding
summary: Make a purchase order on the requested patch
description: |
Make a purchase order on the requested patch.
parameters:
- in: query
name: order_id
schema:
type: string
required: true
description: ID of the order to place. Receive `order_id` by requesting a quote.
responses:
'200':
description: "200 Response"
content:
application/json:
schema:
$ref: "#/components/schemas/OrderPlacedSchema"
'401':
description: Bad Request. Invalid or missing key.
'402':
description: Insufficient balance to get quote.
components:
parameters:
ApikeyParam:
in: query
name: apikey
description: The User's valid Api Key
schema:
type: string
required: true
LatParam:
in: query
name: lat
description: >
Latitude of the Region of Interest (ROI). Must be used together with `longitude`.
For a bounding box ROI, use \{`long1`, `lat1`, `long1`, `long2`\} instead.
schema:
type: number
LongParam:
in: query
name: long
description: >
Longitude of the Region of Interest (ROI). Must be used together with `latitude`.
For a bounding box ROI, use \{`lat1`, `long1`, `lat2`, `long2`\} instead.
schema:
type: number
BboxLat1Param:
in: query
name: lat1
description: >
Define a bounding box Region of Interest (ROI), provide all of \{`lat1`, `long1`, `lat1`, `long2`\}
For a point location, use \{`lat`, `long`\} instead.
schema:
type: number
BboxLong1Param:
in: query
name: long1
description: >
Define a bounding box Region of Interest (ROI), provide all of \{`lat1`, `long1`, `lat1`, `long2`\}
For a point location, use \{`lat`, `long`\} instead.
schema:
type: number
BboxLat2Param:
in: query
name: lat2
description: >
Define a bounding box Region of Interest (ROI), provide all of \{`lat1`, `long1`, `lat1`, `long2`\}
For a point location, use \{`lat`, `long`\} instead.
schema:
type: number
BboxLong2Param:
in: query
name: long2
description: >
Define a bounding box Region of Interest (ROI), provide all of \{`lat1`, `long1`, `lat1`, `long2`\}
For a point location, use \{`lat`, `long`\} instead.
schema:
type: number
LocationParam:
in: query
name: location
description: >
Text description of the Region of Interest (ROI).
This parameter is incompatible with lat/long or bounding box parameters
schema:
type: string
schemas:
QuoteSchema:
title: "Quote provided schema"
type: "object"
OrderPlacedSchema:
title: "Order Placed Schema"
type: "object"
QueryResponseSchema:
title: "Query Response Schema"
type: "object"
# 'user': user,
# 'endpoint': endpoint,
# 'timestamp': timestamp,
# 'params': { k: v for k, v in params.items() if k.lower() != 'apikey' }
Empty:
title: "Empty schema"
type: "object"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment