FIWARE Context Information API

The Context Information API from FIWARE — 4 operation(s) for context information.

OpenAPI Specification

fiware-context-information-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 Information API
  contact:
    email: NGSI-LD@etsi.org
tags:
- name: Context Information
paths:
  /entities/:
    get:
      description: Retrieve a set of entities which matches a specific query from an NGSI-LD system
      operationId: queryEntities
      tags:
      - Context Information
      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/csf'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/options'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/EntityList'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/EntityList-example.json
        '400':
          description: Bad request
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    post:
      description: Create a new Entity within an NGSI-LD system
      operationId: createEntity
      tags:
      - Context Information
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/Entity'
      responses:
        '201':
          description: Created. Contains the resource URI of the created Entity
        '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'
        '422':
          description: Unprocessable Entity
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /entities/{entityId}:
    get:
      description: Retrieve an specific Entity from an NGSI-LD system. It's possible to specify the Entity attributes to be retrieved by using query parameters
      operationId: retrieveEntityById
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      - $ref: '#/components/parameters/attrs'
      - $ref: '#/components/parameters/parameters-type'
      - $ref: '#/components/parameters/options'
      responses:
        '200':
          description: OK
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/Entity'
              examples:
                simple:
                  externalValue: https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/examples/Entity-example.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'
    delete:
      description: Removes an specific Entity from an NGSI-LD system
      operationId: removeEntityById
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      - $ref: '#/components/parameters/parameters-type'
      responses:
        '204':
          description: No Content. The entity 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'
  /entities/{entityId}/attrs/:
    post:
      description: Append new Entity attributes to an existing Entity within an NGSI-LD system
      operationId: appendEntityAttrs
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      - $ref: '#/components/parameters/parameters-options'
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/EntityFragment'
      responses:
        '204':
          description: No Content
        '207':
          description: Partial Success. Only the attributes included in the response payload were successfully appended
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/UpdateResult'
        '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: Update existing Entity attributes within an NGSI-LD system
      operationId: updateEntityAttrs
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/EntityFragment'
      responses:
        '204':
          description: No Content.
        '207':
          description: Partial Success. Only the attributes included in the response payload were successfully updated
          content:
            application/json;application/ld+json:
              schema:
                $ref: '#/components/schemas/UpdateResult'
        '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'
  /entities/{entityId}/attrs/{attrId}:
    patch:
      description: Update existing Entity attributes within an NGSI-LD system
      operationId: partialAttrUpdate
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      - $ref: '#/components/parameters/attrId'
      requestBody:
        required: true
        content:
          application/json;application/ld+json:
            schema:
              $ref: '#/components/schemas/EntityFragment'
      responses:
        '204':
          description: No Content.
        '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 existing Entity attribute within an NGSI-LD system
      operationId: removeEntityAttr
      tags:
      - Context Information
      parameters:
      - $ref: '#/components/parameters/entityId'
      - $ref: '#/components/parameters/attrId'
      responses:
        '204':
          description: No Content.
        '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:
  schemas:
    Entity:
      allOf:
      - required:
        - id
        - type
      - $ref: '#/components/schemas/EntityFragment'
    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'
    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'
    Relationship:
      type: object
      properties:
        type:
          type: string
          enum:
          - Relationship
        object:
          type: string
          format: uri
        observedAt:
          $ref: '#/components/schemas/observedAt'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        modifiedAt:
          $ref: '#/components/schemas/modifiedAt'
        datasetId:
          $ref: '#/components/schemas/datasetId'
        instanceId:
          $ref: '#/components/schemas/instanceId'
      required:
      - type
      - object
      additionalProperties:
        oneOf:
        - $ref: '#/components/schemas/Property'
        - $ref: '#/components/schemas/Relationship'
    georel:
      oneOf:
      - type: string
        enum:
        - equals
        - disjoint
        - intersects
        - within
        - contains
        - overlaps
      - type: string
        pattern: ^near;((maxDistance==\d+)|(minDistance==\d+))$
    Property:
      type: object
      properties:
        type:
          type: string
          enum:
          - Property
        value:
          oneOf:
          - string
          - number
          - boolean
          - array
          - object
        observedAt:
          $ref: '#/components/schemas/observedAt'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        modifiedAt:
          $ref: '#/components/schemas/modifiedAt'
        datasetId:
          $ref: '#/components/schemas/datasetId'
        instanceId:
          $ref: '#/components/schemas/instanceId'
      required:
      - type
      - value
      additionalProperties:
        oneOf:
        - $ref: '#/components/schemas/Property'
        - $ref: '#/components/schemas/Relationship'
    NotUpdatedDetails:
      type: object
      properties:
        attributeName:
          type: string
        reason:
          type: string
          minLength: 1
    modifiedAt:
      type: string
      format: date-time
    Polygon:
      type: object
      properties:
        type:
          type: string
          enum:
          - Polygon
        coordinates:
          $ref: '#/components/schemas/polygon'
    EntityFragment:
      type: object
      properties:
        '@context':
          $ref: '#/components/schemas/LdContext'
        location:
          $ref: '#/components/schemas/GeoProperty'
        observationSpace:
          $ref: '#/components/schemas/GeoProperty'
        operationSpace:
          $ref: '#/components/schemas/GeoProperty'
        id:
          type: string
          format: uri
        type:
          $ref: '#/components/schemas/Name'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        modifiedAt:
          $ref: '#/components/schemas/modifiedAt'
      additionalProperties:
        oneOf:
        - $ref: '#/components/schemas/Property'
        - $ref: '#/components/schemas/Relationship'
        - $ref: '#/components/schemas/GeoProperty'
    position:
      description: A single position
      type: array
      minItems: 2
      maxItems: 2
      items:
        type: number
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        detail:
          type: string
      required:
      - type
    linearRing:
      description: An array of four positions where the first equals the last
      allOf:
      - $ref: '#/components/schemas/positionArray'
      - minItems: 4
    MultiPoint:
      type: object
      properties:
        type:
          type: string
          enum:
          - MultiPoint
        coordinates:
          $ref: '#/components/schemas/positionArray'
    datasetId:
      type: string
      format: uri
    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
    EntityList:
      type: array
      items:
        $ref: '#/components/schemas/Entity'
    polygon:
      description: An array of linear rings
      type: array
      items:
        $ref: '#/components/schemas/linearRing'
    UpdateResult:
      type: object
      properties:
        updated:
          type: array
          items:
            type: string
        notUpdated:
          type: array
          items:
            $ref: '#/components/schemas/NotUpdatedDetails'
    GeoProperty:
      type: object
      properties:
        type:
          type: string
          enum:
          - GeoProperty
        value:
          $ref: '#/components/schemas/Geometry'
        observedAt:
          $ref: '#/components/schemas/observedAt'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        modifiedAt:
          $ref: '#/components/schemas/modifiedAt'
        datasetId:
          $ref: '#/components/schemas/datasetId'
        instanceId:
          $ref: '#/components/schemas/instanceId'
      required:
      - type
      - value
      additionalProperties:
        oneOf:
        - $ref: '#/components/schemas/Property'
        - $ref: '#/components/schemas/Relationship'
    instanceId:
      type: string
      format: uri
    observedAt:
      type: string
      format: date-time
    MultiPolygon:
      type: object
      properties:
        type:
          type: string
          enum:
          - MultiPolygon
        coordinates:
          type: array
          items:
            $ref: '#/components/schemas/polygon'
    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
  parameters:
    coordinates:
      name: coordinates
      description: Coordinates serialized as a string
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/coordinates'
    entityId:
      name: entityId
      description: Entity Id
      in: path
      required: true
      schema:
        type: string
        format: uri
    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
    type:
      name: type
      description: Comma separated list of Entity type names to be retrieved
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    id:
      name: id
      description: Comma separated list of URIs to be retrieved
      in: query
      required: false
      schema:
        type: string
        format: uri
    options:
      name: options
      description: Options dictionary
      in: query
      required: false
      schema:
        type: string
        enum:
        - keyValues
        - sysAttrs
    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
    attrId:
      name: attrId
      description: Attribute Id
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/Name'
    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'
    csf:
      name: csf
      description: Context Source Filter
      in: query
      required: false
      schema:
        type: string
        minLength: 1
    georel:
      name: georel
      description: Geo-relationship
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/georel'
    parameters-type:
      name: type
      description: Entity Type
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/Name'
    parameters-options:
      name: options
      description: Indicates that no attribute overwrite shall be performed
      in: query
      required: false
      schema:
        type: string
        enum:
        - noOverwrite
    limit:
      name: limit
      description: Pagination limit
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
externalDocs:
  description: Find out more about the ETSI ISG Context Information Management
  url: https://portal.etsi.org/tb.aspx?tbid=854&SubTB=854