FIWARE Context Sources API

The Context Sources API from FIWARE — 4 operation(s) for context sources.

OpenAPI Specification

fiware-context-sources-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  description: This OAS file describes the NGSI-LD API defined by the ETSI ISG CIM group. This Cross-domain Context Information Management API allows to provide, consume and subscribe to context information in multiple scenarios and involving multiple stakeholders
  version: latest
  title: ETSI ISG CIM / NGSI-LD API Entry Point Context Sources API
  contact:
    email: NGSI-LD@etsi.org
tags:
- name: Context Sources
paths:
  /csourceRegistrations/:
    get:
      description: Retrieve a set of context sources which matches a specific query from an NGSI-LD system
      operationId: queryCsources
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/id'
      - $ref: '#/components/parameters/idPattern'
      - $ref: '#/components/parameters/type'
      - $ref: '#/components/parameters/attrs'
      - $ref: '#/components/parameters/q'
      - $ref: '#/components/parameters/georel'
      - $ref: '#/components/parameters/geometry'
      - $ref: '#/components/parameters/coordinates'
      - $ref: '#/components/parameters/geoproperty'
      - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ContextSourceRegistrationList'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/ContextSourceRegistrationList-example.json
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    post:
      description: Registers a new context source within an NGSI-LD system
      operationId: registerCsource
      tags:
      - Context Sources
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/ContextSourceRegistration'
      responses:
        '201':
          description: Created. Contains the resource URI of the created Registration
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Already exists
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /csourceRegistrations/{registrationId}:
    get:
      description: Retrieves a specific context source registration from an NGSI-LD system
      operationId: retrieveCsource
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/registrationId'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ContextSourceRegistration'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      description: Removes an specific context source registration within an NGSI-LD system
      operationId: removeCsource
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/registrationId'
      responses:
        '204':
          description: No Content. The Registration was removed successfully
        '400':
          description: Bad Request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /csourceSubscriptions/:
    get:
      description: Retrieves the context source discovery subscriptions available in an NGSI-LD system
      operationId: retrieveCSourceSubscriptions
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/SubscriptionList'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/SubscriptionList-example.json
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    post:
      description: Creates a context source discovery Subscription within an NGSI-LD system
      operationId: createCSourceSubscription
      tags:
      - Context Sources
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/Subscription'
      responses:
        '201':
          description: Created. Contains the resource URI of the created Subscription
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Already exists
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /csourceSubscriptions/{subscriptionId}:
    get:
      description: Retrieves a specific Subscription from an NGSI-LD system
      operationId: retrieveCSourceSubscriptionsById
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/Subscription'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/Subscription-example_C.4.json
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    patch:
      description: Updates a specific context source discovery Subscription within an NGSI-LD system
      operationId: updateCSourceSubscription
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/SubscriptionFragment'
      responses:
        '204':
          description: No Content. The Subscription was updated successfully
        '400':
          description: Bad Request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      description: Removes a specific Context Source Subscription from an NGSI-LD system
      operationId: removeCSourceSubscription
      tags:
      - Context Sources
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      responses:
        '204':
          description: No Content. The Subscription was removed successfully
        '400':
          description: Bad Request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  parameters:
    coordinates:
      name: coordinates
      description: Coordinates serialized as a string
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/coordinates'
    geoproperty:
      name: geoproperty
      description: The name of the property that contains the geo-spatial data that will be used to resolve the geoquery
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    limit:
      name: limit
      description: Pagination limit
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
    type:
      name: type
      description: Comma separated list of Entity type names to be retrieved
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    subscriptionId:
      name: subscriptionId
      description: Subscription Id
      in: path
      required: true
      schema:
        type: string
        format: uri
    id:
      name: id
      description: Comma separated list of URIs to be retrieved
      in: query
      required: false
      schema:
        type: string
        format: uri
    attrs:
      name: attrs
      description: Comma separated list of attribute names (properties or relationships) to be retrieved
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    q:
      name: q
      description: Query
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    idPattern:
      name: idPattern
      description: Regular expression that must be matched by Entity ids
      in: query
      required: false
      schema:
        type: string
        format: regexp
    geometry:
      name: geometry
      description: Geometry
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/geometry'
    georel:
      name: georel
      description: Geo-relationship
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/georel'
    registrationId:
      name: registrationId
      description: Registration Id
      in: path
      required: true
      schema:
        type: string
        format: uri
  schemas:
    ContextSourceRegistrationFragment:
      type: object
      properties:
        '@context':
          $ref: '#/components/schemas/LdContext'
        information:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/RegistrationInfo'
        observationInterval:
          $ref: '#/components/schemas/TimeInterval'
        managementInterval:
          $ref: '#/components/schemas/TimeInterval'
        location:
          $ref: '#/components/schemas/Geometry'
        observationSpace:
          $ref: '#/components/schemas/Geometry'
        operationSpace:
          $ref: '#/components/schemas/Geometry'
        expires:
          type: string
          format: date-time
        name:
          type: string
          minLength: 1
        description:
          type: string
          minLength: 1
        endpoint:
          type: string
          format: uri
      additionalProperties: true
    positionArray:
      description: An array of positions
      type: array
      items:
        $ref: '#/components/schemas/position'
    LineString:
      type: object
      properties:
        type:
          type: string
          enum:
          - LineString
        coordinates:
          $ref: '#/components/schemas/lineString'
    MultiLineString:
      type: object
      properties:
        type:
          type: string
          enum:
          - MultiLineString
        coordinates:
          type: array
          items:
            $ref: '#/components/schemas/lineString'
    ContextSourceRegistration:
      allOf:
      - $ref: '#/components/schemas/ContextSourceRegistrationFragment'
      - type: object
        properties:
          id:
            type: string
            format: uri
          type:
            type: string
            enum:
            - ContextSourceRegistration
          createdAt:
            $ref: '#/components/schemas/createdAt'
          modifiedAt:
            $ref: '#/components/schemas/modifiedAt'
        required:
        - id
        - type
        - endpoint
        - information
    geometry:
      type: string
      enum:
      - Point
      - MultiPoint
      - LineString
      - MultiLineString
      - Polygon
      - MultiPolygon
    Name:
      type: string
      pattern: ^((\d|[a-zA-Z]|_)+(:(\d|[a-zA-Z]|_)+)?(#\d+)?)$
      minLength: 1
      description: NGSI-LD Name
    Point:
      type: object
      properties:
        type:
          type: string
          enum:
          - Point
        coordinates:
          $ref: '#/components/schemas/position'
    georel:
      oneOf:
      - type: string
        enum:
        - equals
        - disjoint
        - intersects
        - within
        - contains
        - overlaps
      - type: string
        pattern: ^near;((maxDistance==\d+)|(minDistance==\d+))$
    SubscriptionFragment:
      type: object
      properties:
        '@context':
          $ref: '#/components/schemas/LdContext'
        entities:
          type: array
          items:
            $ref: '#/components/schemas/EntityInfo'
          minItems: 1
        name:
          type: string
          minLength: 1
        description:
          type: string
          minLength: 1
        watchedAttributes:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Name'
          uniqueItems: true
        timeInterval:
          type: number
          minimum: 0
        expires:
          type: string
          format: date-time
        isActive:
          type: boolean
        throttling:
          type: number
          minimum: 1
        q:
          type: string
        geoQ:
          $ref: '#/components/schemas/GeoQuery'
        csf:
          type: string
    modifiedAt:
      type: string
      format: date-time
    Polygon:
      type: object
      properties:
        type:
          type: string
          enum:
          - Polygon
        coordinates:
          $ref: '#/components/schemas/polygon'
    TimeInterval:
      type: object
      required:
      - start
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
    ContextSourceRegistrationList:
      type: array
      items:
        $ref: '#/components/schemas/ContextSourceRegistration'
    position:
      description: A single position
      type: array
      minItems: 2
      maxItems: 2
      items:
        type: number
      additionalProperties: false
    GeoQuery:
      type: object
      required:
      - geometry
      - coordinates
      - georel
      properties:
        georel:
          $ref: '#/components/schemas/georel'
        coordinates:
          $ref: '#/components/schemas/coordinates'
        geometry:
          $ref: '#/components/schemas/geometry'
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        detail:
          type: string
      required:
      - type
    NotificationParams:
      type: object
      properties:
        attributes:
          type: array
          minItems: 1
          items:
            type: string
            minLength: 1
          uniqueItems: true
        format:
          type: string
        endpoint:
          $ref: '#/components/schemas/Endpoint'
        status:
          type: string
          enum:
          - ok
          - failed
        timesSent:
          type: number
          minimum: 1
        lastNotification:
          type: string
          format: date-time
        lastFailure:
          type: string
          format: date-time
        lastSuccess:
          type: string
          format: date-time
      required:
      - endpoint
    linearRing:
      description: An array of four positions where the first equals the last
      allOf:
      - $ref: '#/components/schemas/positionArray'
      - minItems: 4
    Subscription:
      allOf:
      - $ref: '#/components/schemas/SubscriptionFragment'
      - type: object
        properties:
          id:
            type: string
            format: uri
          type:
            type: string
            enum:
            - Subscription
          notification:
            $ref: '#/components/schemas/NotificationParams'
          status:
            type: string
            enum:
            - active
            - paused
            - expired
          createdAt:
            $ref: '#/components/schemas/createdAt'
          modifiedAt:
            $ref: '#/components/schemas/modifiedAt'
        allOf:
        - required:
          - id
          - type
          - notification
        - anyOf:
          - required:
            - entities
          - required:
            - watchedAttributes
    MultiPoint:
      type: object
      properties:
        type:
          type: string
          enum:
          - MultiPoint
        coordinates:
          $ref: '#/components/schemas/positionArray'
    coordinates:
      oneOf:
      - $ref: '#/components/schemas/position'
      - $ref: '#/components/schemas/positionArray'
      - $ref: '#/components/schemas/lineString'
      - $ref: '#/components/schemas/polygon'
    lineString:
      description: An array of two or more positions
      allOf:
      - $ref: '#/components/schemas/positionArray'
      - minItems: 2
    RegistrationInfo:
      type: object
      properties:
        entities:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/EntityInfo'
        properties:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Name'
          uniqueItems: true
        relationships:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Name'
          uniqueItems: true
    polygon:
      description: An array of linear rings
      type: array
      items:
        $ref: '#/components/schemas/linearRing'
    SubscriptionList:
      type: array
      items:
        $ref: '#/components/schemas/Subscription'
    MultiPolygon:
      type: object
      properties:
        type:
          type: string
          enum:
          - MultiPolygon
        coordinates:
          type: array
          items:
            $ref: '#/components/schemas/polygon'
    Endpoint:
      type: object
      required:
      - uri
      properties:
        uri:
          type: string
          format: uri
        accept:
          type: string
          enum:
          - application/json
          - application/ld+json
    LdContext:
      oneOf:
      - type: object
      - type: string
        format: uri
      - type: array
        minItems: 1
        items:
          oneOf:
          - type: string
            format: uri
          - type: object
    Geometry:
      description: ' Avalid GeoJSON geometry object'
      oneOf:
      - $ref: '#/components/schemas/Point'
      - $ref: '#/components/schemas/MultiPoint'
      - $ref: '#/components/schemas/Polygon'
      - $ref: '#/components/schemas/LineString'
      - $ref: '#/components/schemas/MultiLineString'
      - $ref: '#/components/schemas/MultiPolygon'
    createdAt:
      type: string
      format: date-time
    EntityInfo:
      type: object
      properties:
        id:
          type: string
          format: uri
        type:
          $ref: '#/components/schemas/Name'
        idPattern:
          type: string
          format: regex
      required:
      - type
externalDocs:
  description: Find out more about the ETSI ISG Context Information Management
  url: https://portal.etsi.org/tb.aspx?tbid=854&SubTB=854