{"mock":"https://private-anon-b1988e1423-ngsiurbanmobilitytogtfsapi.apiary-mock.com","proxy":"https://private-anon-b1988e1423-ngsiurbanmobilitytogtfsapi.apiary-proxy.com"}
openapi: 3.0.1
info:
title: NGSI Urban Mobility to GTFS API
description: 'This service converts NGSI Entities compliant to the SynchroniCity Urban Mobility Data Models to the native GTFS format In particular the atomic service consumes the entities from an Orion Context Broker and generates the GTFS feed archive. See Urban Mobility specification [here](https://github.com/Fiware/dataModels/tree/master/specs/UrbanMobility).
The Urban Mobility to GTFS APIs are composed by two sets of RESTful services:
- Urban Mobility Query API
- GTFS Translation API
'
contact:
email: ermanno.mastrosimone@gmail.com
license:
name: GNU Affero General Public License 3.0
url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
version: 1.0.0
externalDocs:
description: Find out more about Urban Mobility to GTFS Service
url: 'https://gitlab.com/synchronicity-iot/ngsiurbanmobility-to-gtfs'
servers:
- url: 'http://localhost:8081/api'
tags:
- name: Urban Mobility Query API
description: The Urban Mobility Query API allows to query for NGSI Urban Mobility entities, available in a configured Context Broker.
- name: GTFS Translation API
description: Access to Petstore orders
paths:
'/urbanmobility/agencies':
get:
tags:
- Urban Mobility Query API
summary: Return the (paginated) list of the available Urban Mobility Agencies (gtfs:Agency).
operationId: getAgencies
parameters:
- name: rows
in: query
description: Used to paginate the results and represents the number of returned results.
required: false
schema:
type: integer
default: 20
- name: offset
in: query
description: Used to paginate the results and represents the first element of the result list from which to start.
required: false
schema:
type: integer
default: 0
- name: Fiware-Service
in: header
schema:
type: string
- name: Fiware-ServicePath
in: header
schema:
type: string
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GtfsAgency'
example:
[
{
"id": "urn:ngsi-ld:GtfsAgency:Malaga_EMT",
"type": "GtfsAgency",
"language": "ES",
"name": "Empresa Malagueña de Transportes",
"page": "http://www.emtmalaga.es/",
"source": "http://datosabiertos.malaga.eu/dataset/lineas-y-horarios-bus-google-transit/resource/24e86888-b91e-45bf-a48c-09855832fd52",
"timezone": "Europe/Madrid"
}
]
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'/urbanmobility/routes':
get:
tags:
- Urban Mobility Query API
summary: Return the (paginated) list of the available Urban Mobility Routes (gtfs:Route), issued by one or more gtfs:Agency.
operationId: getRoutes
parameters:
- name: rows
in: query
description: Used to paginate the results and represents the number of returned results.
required: false
schema:
type: integer
default: 20
- name: offset
in: query
description: Used to paginate the results and represents the first element of the result list from which to start.
required: false
schema:
type: integer
default: 0
- name: Fiware-Service
in: header
schema:
type: string
- name: Fiware-ServicePath
in: header
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GtfsRoute'
example:
[
{
"id": "urn:ngsi-ld:GtfsRoute:Spain:Malaga:1",
"type": "GtfsRoute",
"name": "Parque del Sur _ Alameda Principal _ San Andrés",
"operatedBy": "urn:ngsi-ld:GtfsAgency:Malaga_EMT",
"page": "http://www.emtmalaga.es/emt-mobile/informacionLinea.html",
"routeType": "3",
"shortName": "1"
}
]
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'/urbanmobility/routes/{agencyId}':
get:
tags:
- Urban Mobility Query API
summary: Return the (paginated) list of the available Urban Mobility Routes (gtfs:Route), issued by the specified transit agency (Id of GtfsAgency).
operationId: getRoutesByAgencyId
parameters:
- name: agencyId
in: path
description: The Identifier of a GtfsAgency, retrieved with the dedicated Urban Mobility Query API (getAgencies).
required: true
schema:
type: string
- name: rows
in: query
description: Used to paginate the results and represents the number of returned results.
required: false
schema:
type: integer
default: 20
- name: offset
in: query
description: Used to paginate the results and represents the first element of the result list from which to start.
required: false
schema:
type: integer
default: 0
- name: Fiware-Service
in: header
schema:
type: string
- name: Fiware-ServicePath
in: header
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GtfsRoute'
example:
{
"id": "urn:ngsi-ld:GtfsRoute:Spain:Malaga:1",
"type": "GtfsRoute",
"name": "Parque del Sur _ Alameda Principal _ San Andrés",
"operatedBy": "urn:ngsi-ld:GtfsAgency:Malaga_EMT",
"page": "http://www.emtmalaga.es/emt-mobile/informacionLinea.html",
"routeType": "3",
"shortName": "1"
}
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'/urbanmobility/trips/{routeId}':
get:
tags:
- Urban Mobility Query API
summary: Return the (paginated) list of the available Urban Mobility Trips (GtfsTrip), belonging to the specified GtfsRoute.
operationId: getTripsByRouteId
parameters:
- name: routeId
in: path
description: The Identifier of the GtfsRoute to which belongs the requested Trips.
required: true
schema:
type: string
- name: rows
in: query
description: Used to paginate the results and represents the number of returned results.
required: false
schema:
type: integer
default: 20
- name: offset
in: query
description: Used to paginate the results and represents the first element of the result list from which to start.
required: false
schema:
type: integer
default: 0
- name: Fiware-Service
in: header
schema:
type: string
- name: Fiware-ServicePath
in: header
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GtfsTrip'
example:
[
{
"id": "urn:ngsi-ld:GtfsTrip:Spain:Malaga:1",
"type": "GtfsTrip",
"direction": 0,
"hasRoute": "urn:ngsi-ld:GtfsRoute:Spain:Malaga:1",
"hasService": "urn:ngsi-ld:GtfsService:Malaga_LAB",
"hasShape": "urn:ngsi-ld:GtfsShape:101",
"headSign": "San Andrés"
}
]
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'/gtfs/agencies/{agencyId}':
get:
tags:
- GTFS Translation API
summary: Get Translated GTFS Feed archive
description: 'Return the GTFS feed archive containing the translation of all the routes (gtfs:Route) and related entities, issued by one or more gtfs:Agency, such as: GtfsTrip, Gtfs:StopTime, GtfsStop, GtfsService, etc. See Urban Mobility specification [here](https://github.com/Fiware/dataModels/tree/master/specs/UrbanMobility)'
operationId: getGTFSByAgency
parameters:
- name: agencyId
in: path
description: The Identifier of a GtfsAgency, retrieved with the dedicated Urban Mobility Query API (getAgencies).
required: true
schema:
type: string
- name: Fiware-Service
in: header
schema:
type: string
- name: Fiware-ServicePath
in: header
schema:
type: string
- name: writeZip
in: query
description: Whether to write or not the Zip in the configured folder (if the Zip was not present, it is always written, regardless of this parameter).
schema:
type: boolean
default: false
- name: returnZip
in: query
description: Whether to return or not the Zip as file download.
schema:
type: boolean
default: true
responses:
'200':
description: This entity represents public transportation schedules and associated geographic information in the form of GTFS Feed archive (ZIP file), containing the files resulting from the translation of corresponding Urban Mobility NGSI entities.
content:
application/zip:
schema:
type: string
format: binary
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
GtfsAgency:
description: This entity, mapped from the corresponding GTFS member agency.txt , represents the transportation agency that provides data relative to one or more transit schedule.
required:
- id
- type
- source
- name
properties:
id:
type: string
description: Entity identifier.
type:
type: string
description: It must be equal to GtfsAgency.
dateCreated:
type: string
format: date-time
description: Entity creation timestamp.
dateModified:
type: string
format: date-time
description: Entity last modify timestamp.
dataProvider:
type: string
description: URL pointing to the provider of this information.
source:
type: string
format: uri
description: Original source of the entity data as a URL. It must point to the URL of the original GTFS feed used to generate it.
name:
type: string
description: Full name of the transit agency.
page:
type: string
format: uri
description: URL of the transit agency.
timezone:
type: string
description: Timezone where the transit agency is located.
phone:
type: string
description: Single voice telephone number for the specified agency
language:
type: string
description: IETF BCP 47 language code specifying the primary language used by the transit agency
address:
type: string
description: Agency's civic address
GtfsRoute:
description: This entity, mapped from the corresponding GTFS member routes.txt, represents the transit route, intended as a group of trips that are displayed to riders as a single service.
required:
- id
- type
- routeType
- operatedBy
properties:
id:
type: string
description: Entity identifier.
type:
type: string
description: It must be equal to GtfsRoute.
dateCreated:
type: string
format: date-time
description: Entity creation timestamp.
dateModified:
type: string
format: date-time
description: Entity last modify timestamp.
dataProvider:
type: string
description: URL pointing to the provider of this information.
source:
type: string
format: uri
description: Original source of the entity data as a URL. It must point to the URL of the original GTFS feed used to generate it.
name:
type: string
description: Full name of the route
shortName:
type: string
description: Short name of the route.
description:
type: string
description: Useful description of the route.
routeType:
type: string
description: TThe type of transportation used on the route. Allowed values as prescribed by GTFS specification for route_type field.
page:
type: string
format: uri
description: URL of a web page about the route.
routeColor:
type: string
description: In systems that have colors assigned to routes, the route_color field defines a color that corresponds to a route. Allowed values as prescribed by GTFS specification for route_color field.
routeTextColor:
type: string
description: Legible color to use for text drawn against a background of routeColor. Allowed values as prescribed by GTFS specification for route_text_color field.
operatedBy:
type: string
description: Identifier of transport Agency (GtfsAgency entity) that operates this route.
GtfsTrip:
description: This entity, mapped from the corresponding GTFS member, trips.txt, represents the trip composing a specific route. A trip is a sequence of two or more stops that occurs at specific time.
required:
- id
- type
- hasService
- hasRoute
properties:
id:
type: string
description: Entity identifier.
type:
type: string
description: It must be equal to GtfsRoute.
dateCreated:
type: string
format: date-time
description: Entity creation timestamp.
dateModified:
type: string
format: date-time
description: Entity last modify timestamp.
dataProvider:
type: string
description: URL pointing to the provider of this information.
source:
type: string
format: uri
description: Original source of the entity data as a URL. It must point to the URL of the original GTFS feed used to generate it.
headSign:
type: string
description: The text that appears in schedules and sign boards to identify the trip to passengers.
shortName:
type: string
description: Short name of the route.
direction:
type: integer
enum:
- 0
- 1
description: A binary value that indicates the direction of travel for a trip.
block:
type: string
description: The block to which the trip belongs. A block consists of a single trip or many sequential trips made using the same vehicle.
hasService:
type: string
description: Identifier that uniquely identifies a set of dates when service is available for one or more routes. It shall point to an Entity of Type GtfsService.
hasShape:
type: string
description: Identifier that refers to the geographical shape associated to the trip encoded as GeoJSON LineString or MultiLineString. It shall point to an Entity of Type GtfsShape.
hasRoute:
type: string
description: The Identifier of a GtfsRoute entity to which this trip refers to.
wheelChairAccessible:
type: string
description: Accessibility information for the trip. Indicates if riders in wheelchairs can be accommodated on this trip. Allowed values as prescribed by GTFS specification for wheelchair_accessible field.
enum:
- 0
- 1
- 2
bikesAllowed:
type: string
description: Indicates if bicycles are allowed for this trip. Allowed values as prescribed by GTFS specification for wheelchair_accessible field.
enum:
- 0
- 1
- 2
Error:
type: object
properties:
status:
type: integer
format: int32
stack:
type: string
message:
type: string