openapi: 3.0.2

schemes:
  - "http"
  - "https"

produces:
  - "application/json"
  - "text/plain"

consumes:
  - "application/json"
  - "text/plain"

info:
  title: "Data exchange Resource Server Proxy APIs"
  version: 5.5.0
  description: |
    # Introduction
    The Resource Proxy Server is DXs'(Data Exchange) data discovery portal.
    The consumers can access data from the resource server proxy using HTTPs.
    It supports Complex (Temporal + Attribute), Temporal (Before, during, After) and Attribute searches.
    It integrates with authorization server (token introspection) to serve private data as per the access control policies set by the provider
    It secures data access over TLS
    
    
    # Configurations
    - **Server**: 
      - In the doc, we display the server url to be https://example-proxy.com with the hostname as example-proxy.com
      - This could be configured according to the deployment
    - **Base path**:
      - Base path is the path on which API is served, relative to the host
      - It is the initial part of the API
      - These base path values could be configured according to the deployment
      - The base path for [DX AAA Server](https://github.com/datakaveri/iudx-aaa-server) is set to `/auth/v1`
      - The base path for [DX Catalogue Server](https://github.com/datakaveri/iudx-catalogue-server) is set to `/iudx/cat/v1`
          Currently, the following APIs have `/ngsi-ld/v1` base path
          -  /entities
          -  /temporal/entities
          -  /temporal/entityOperations/query
          -  /entityOperations/query
          -  /async/search
          -  /async/status
          -  /consumer/audit
          -  /provider/audit
          -  /overview
          -  /summary
          <br>
    - **Request Samples**:
      - The `<tokeValue>` in the header of request sample could be replaced with respective token value [Also refer Tokens section [here](#section/Tokens)]
      - The `<publicKeyValue>` in the header of request sample could be replaced with the respective public key [Also refer Encryption section [here](#section/Encryption)]
      - The `<payload>` in the request sample could be replaced with the payload given adjacent to the request sample
    
    
    # Tokens
    All the <b>*Search API*</b>  calls to the resource server proxy should now contain a valid data exchange auth token presented in the query header. To search (or) access an *Open* resource, the consumer should present a valid data exchange Auth token. To search (or) access a *Secure / Closed* resource, a consumer must get a token for the *Secure / Closed* resource along with the associated constraints from the DX(Data exchange) Auth Server. For subscription to a *Secure / Closed / Open* resource, a consumer must get a token along with the associated constraints from the DX(Data exchange) Auth Server.
    
    # Pagination
    Resource server proxy also offers way to paginate the result for queries. If a query returns large number of records then user can use additional parameters in query parameters to limit numbers of records to be returned.
    
    - <b> Pagination is applicable only for</b>
       - <b>/entities</b>
       - <b>/temporal/entities</b>
       - <b>/temporal/entityOperations/query</b>
       - <b>/entityOperations/query</b>
       - <b>/consumer/audit</b>
       - <b>/provider/audit</b>
    
    Additional query parameters to be used:
      - <b>offset</b> : The from parameter defines the offset from the first result you want to fetch,  ( <i>default : 0</i> ,<i>minValue: 0</i>, <i>maxValue: 49999</i> )
      - <b>limit</b> : The size parameter allows you to configure the maximum results to be returned  ( <i>default: 5000</i> ,<i>minValue: 0</i>, <i>maxValue: 5000</i> )
    
    # Encryption
    All the count and search APIs have a feature to get encrypted data.
    To get the data in encrypted format, the user could provide a `publicKey` in the header. 
    The header value should be in _url-safe base64 format_. 
    
    **Encryption is applicable only for**
    -  **/entities**
    -  **/temporal/entities**
    -  **/temporal/entityOperations/query**
    -  **/entityOperations/query**


    # API HTTP Responses
    Apart from the response codes specified in each API, the API server may respond with certain 4xx and 5xx error codes which are related to common API Gateway behaviours.
    The application should address them accordingly.

  contact:
    name: For support contact IUDX Team at
    email: support@iudx.org.in
    url: https://iudx.org.in/
  license:
    name: Apache 2.0
tags:

  - name: Spatial Entities
    x-displayName: "Spatial Search"
    description: |
      A Spatial Search is used by DX(Data exchange) Data *Consumers* for querying a resource using a <b>valid data exchange</b> `id`, `spatial` and `attribute` parameters. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b>. <br/> You can use this API to make a `spatial` or `attribute` or `complex : spatial+attribute` query.
  - name: Temporal Entities
    x-displayName: "Temporal and Complex Search"
    description: |
      A Temporal Search is used by DX(Data exchange) Data *Consumers* for querying a resource using a <b>valid data exchange</b> `id`, `temporal`, `spatial` and `attribute` parameters. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b>. <br/>In order to use this API, a `temporal` parameter is <b>mandatory</b>. <br/> You can use this API to make a `temporal` or `complex : temporal+spatial` or `complex : temporal+attribute` or `complex : temporal+spatial+attribute` query. <br/> If you are looking for an `attribute` only query refer the <b>Spatial Search</b> `/entities` endpoint.

  - name: Entities Post Query
    x-displayName: "Complex Search (Post Query)"
    description: |
      A Complex Search (Post Query) is an HTTP POST API and is used by DX(Data exchange) Data *Consumers*. <br/>This API is used for querying a resource using a <b>valid data exchange</b> `id`, `temporal`, `spatial` and `attribute` parameters. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b>. <br/> You can use this API to make a `temporal` or `spatial` or `attribute` or `complex : temporal+spatial` or `complex : temporal+attribute` or `complex : spatial+attribute` or `complex : temporal+spatial+attribute` query.

  - name: Metering
    x-display: "Metering/Audit"
    description: |
      Metering APIs provide the ability to the user (Consumer/Provider) to query the audit data using temporal & resource-id query. Access Summary API is an extension of Metering API to provide summary and overview details.

servers:
  - url: 'https://example-proxy.com/ngsi-ld/v1'
    description: 'Development Server URL'

paths:

  /entities:
    get:
      tags:
        - Spatial Entities
      operationId: Spatial Search
      parameters:

        - name: token
          in: header
          description: A <b> valid data exchange Auth token </b> to process the request. <br/> This field is <b> mandatory </b> for accessing a <b> resource </b> .  <br/> If not provided with a valid token, user will be responded with <b> 401 Unauthorized </b> .
          required: true
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'

        - name: id
          in: query
          description: 'A <b> valid data exchange ID </b> of the resource. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b> .'
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36

        - name: geoproperty
          in: query
          description: 'Name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>. <br /> The current version of the API <b> mandates </b> it to be equal to `location`'
          schema:
            type: string
            enum: [location]
        - name: georel
          in: query
          description: 'The relation type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property. <br/> Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields. <br/> The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.  <br/> The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.'
          schema:
            type: string
            enum: [near;maxdistance=<distance_in_meters>, within, intersects]

        - name: geometry
          in: query
          description: 'The geometry type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/>The list is <b>case sensitive</b> '
          schema:
            type: string
            enum: [Point (or) point, Polygon (or) polygon, LineString (or) linestring, bbox]

        - name: coordinates
          in: query
          description: 'The coordinates for a specific geometry query type. <br/> This parameter accepts both <b> one dimentional array and multi dimentional arrays </b> based on the <b> geometry</b> type. <br/> For e.g, [longitude-1,latitude-1] should be used for geometry <b>point</b>.  <br/>[[[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]]] should be used for geometry <b>polygon</b>. <br/> [[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]] should be used for geometry <b>bbox and linestring </b>. <br/> Maximum of 10 latitude, longitude pairs can be used for geometry <b>polygon, bbox and linestring </b>. <br/> Note: The data-type of this field is a string, therefore the coordinates are a string encoded multidimensional array. <br/> Maximum precision allowed is upto 6 decimal places.'
          schema:
            type: array
            minItems: 1
            maxItems: 10
            items:
              type: number
            format: double
        - name: maxDistance
          description: 'The maximum distance to be queried from center point in meters. <br/> This is applicable and is <b>mandatory</b> for <b>point</b> geometry.<br/> It should be used along with relation <b>near</b>.'
          schema:
            type: number
            minimum: 0
            maximum: 1000
          in: query
          required: false

        - name: q
          in: query
          description: 'The attribute query is used for querying <b> allowed quantitative</b> properties. <br/> Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. <br/> For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value, attribute != value and attribute == value. <br/> Allowed values for all operators is double. <br/> For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource.'
          schema:
            type: string
            maxLength: 512

        - name: attrs
          in: query
          description: 'The attrs parameter is used as an <b>application filter</b>. <br/> This is an optional parameter. It can be used to provide the list of attributes which the consumer expects to be responded by the server. <br/> The consumer is expected to provide <b>only</b> the attributes available in the <b>data descriptor</b> of the item in the DX(Data exchange) Catalogue. <br/> Minimum of 1 and a Maximum of 5 attributes can be provided in a comma separated fashion.'
          schema:
            type: string
            maxLength: 512

        - name: options
          in: query
          description: 'The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a query. <br/> It should be used along with the <b> valid </b> `spatial`, `attribute` or `complex` queries. <br/> It <b>cannot</b> be used along with a <b>attrs</b> filter. The value should be equal to `count` and it is <b>case sensitive</b>'
          schema:
            type: string
            enum: [count]


      responses:
        200:
          description: 'Successful query'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entityresponse'
        204:
          description: 'Empty Response'

        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'

      x-codeSamples:
        - lang: 'cURL'
          label: 'search by attribute'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&q=referenceLevel>15.0' \
            --header 'token: <tokenValue>'
        - lang: 'cURL'
          label: 'get encrypted data'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=near;maxdistance=10&geometry=Point&coordinates=[21.178,72.834]&offset=0&limit=10' \
            --header 'token: <tokenValue>' \
            --header 'publicKey: <publicKeyValue>'

        - lang: 'cURL'
          label: 'search by circle'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=near;maxdistance=10&geometry=Point&coordinates=[21.178,72.834]&offset=0&limit=10' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'search by polygon'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=within&geometry=Polygon&coordinates=[[[72.76,21.15],[72.76,21.13],[72.78,21.13],[72.78,21.15],[72.76,21.15]]]' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'search by bbox'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=within&geometry=bbox&coordinates=[[72.8296,21.2],[72.8297,21.15]]' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'search by linestring'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=intersects&geometry=linestring&coordinates=[[72.84,21.19],[72.84,21.17]]' \
            --header 'token: <tokenValue>'


        - lang: 'cURL'
          label: 'search by attribute and filter'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&q=referenceLevel>15.0&attrs=id,currentLevel,referenceLevel' \
            --header 'token: <tokenValue>'


        - lang: 'cURL'
          label: 'count by circle'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/entities?id=UUID&geoproperty=location&georel=near;maxDistance=10&geometry=Point&coordinates=[21.178,72.834]&options=count' \
            --header 'token: <tokenValue>'

      deprecated: false
      description: |
        The `/entities` end point allows a consumer to query on data published based on a <b>spatial</b> and <b>attribute</b> properties. The <b>spatial</b> queries should be submitted as a geo json as described in the API. All the queries requires a <b> valid data exchange </b> `id` of the resource. These apis are intended to be used by DX(Data exchange) Data *Consumers*.

          - <b>Allowed Search Operations</b>: 
              - <b> Spatial (Geo) Search : </b> which queries the geo property of the resource.
              - <b> Attribute Search : </b> which queries the valid attributes as per the data descriptor.
              - <b> Complex Search : </b> which queries using the combination of the above two.
        
        
        #### Spatial (Geo) Search
        Geo search accepts geojson based queries. The params and their accepted values are briefed below -
          - <b>geoproperty</b>: 
              - Specifies the name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>.
              - The current version of the API <b> mandates </b> it to be equal to `location`
          - <b>georel</b>:   
              - Specifies the spatial relationship to be queried.
              - The relation type of <b>geoquery</b> can be <b>one of</b> `near;maxdistance=<distance_in_meters>`, `within`, `intersects`.
              - The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property.
              - Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields.
              - The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.
              - The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.

          - <b>geometry</b>:  
              - Specifies the GeoJson geometries. 
              - Should be One of `Point`(equivalent for a circle), `Polygon`, `LineString`, `bbox`.
              - <b>Point</b>: Point and radius query
                  - coordinates: Specifies the  center point of the circle, for e.g, `[73,13]`. <br/>Note, format is [longitude, latitude]
                  - maxDistance: Specifies the Radius from the center point in meters, for e.g `100`. `maxValue` : 1000
                  - georel: In this version of DX(Data exchange) API, the allowed relationship search for a circle is `near` with a `maxdistance` in meters specified. This will be equivalent to a `within` query. Format is `near;maxdistance=<distance_in_meters>` 
              - <b>Polygon</b>: Polygon/Multi-Polygon query
                  - coordinates: Specifies the  coordinates of the polygon, for e.g, `[[[73,13],[73,12],[73,13]]]`.  <br/>Note, format is [longitude, latitude] and the first coordinate must be same as last. 
                  - `minNumberOfCoOrdinates` : 4 and `maxnNumberOfCoOrdinates` : 10
                  - georel: `within`, `intersects`
              - <b>LineString</b>: Multi line string
                  - coordinates: Specifies the coordinates of the multi-line, for e.g, `[[73,13],[74,15],[75,16]]`. <br/>Note, format is [longitude, latitude]
                  - `minNumberOfCoOrdinates` : 2 and `maxnNumberOfCoOrdinates` : 10
                  - georel:  `within`, `intersects`
              - <b>bbox</b>: Bounding box
                  - coordinates: `[[top-left],[bottom-right]]`. e.g, `[[73,13],[74,12]]`. <br/>Note, format is [longitude, latitude].
                  - georel:  `within`, `intersects`

        #### Attribute search
        The attribute query is used for querying <b> allowed quantitative</b> properties. 
          - Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`,`==` operators. 
          - For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value and attribute == value. 
          - Allowed values for all operators is double. 
          - For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource. 
          - e.g, `q=attribute-name>attribute-value`

        #### Complex search
        A combination of the above is allowed to make searches more  complex.

        #### Filters
          - A subset of properties of returned documents can be filtered out. This is an option parameter. <br/>For e.g, `attrs=[id]` returns documents with only the `id` property retained in them. 
          - `minNumberOfAttributes` : 1 and `maxNumberOfAttributes` : 5 

        #### Options
          - The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a query. 
          - It should be used along with the <b> valid </b> `spatial`, `attribute` or `complex` queries. 
          - It <b>cannot</b> be used along with a <b>attrs</b> filter. 
          - The value should be equal to `count` and it is <b>case sensitive</b>


  /temporal/entities:
    get:
      tags:
        - Temporal Entities
      summary: Temporal Search
      operationId: temporal-entities
      parameters:

        - name: token
          in: header
          description: A <b> valid data exchange Auth token </b> to process the request. <br/> This field is <b> mandatory </b> for accessing a <b> resource </b> .  <br/> If not provided with a valid token, user will be responded with <b> 401 Unauthorized </b> .
          required: true
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'

        - name: id
          in: query
          description: 'A <b> valid data exchange ID </b> of the resource. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b> .'
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36

        - name: timerel
          in: query
          description: 'The temporal relation type of <b>timerel</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> If the relation is <b> between </b> it should be always accomodated with a <b> time </b> and <b> endtime </b> property.  <br/> If the relation is <b> before </b> or <b> after </b>it should be always accomodated <b> only</b> with a <b> time </b> property.'
          required: true
          schema:
            type: string
            enum: [between, before, after]
        - name: time
          in: query
          description: 'This parameter specifies the <b>start time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          required: true
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query. <br/>If <b>timerel</b> is `between` time and endtime are mandatory'
          schema:
            type: string

        - name: geoproperty
          in: query
          description: 'Name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>. <br /> The current version of the API <b> mandates </b> it to be equal to `location`'
          schema:
            type: string
            enum: [location]
        - name: georel
          in: query
          description: 'The relation type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property. <br/> Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields. <br/> The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.  <br/> The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.'
          schema:
            type: string
            enum: [near;maxdistance=<distance_in_meters>, within, intersects]

        - name: geometry
          in: query
          description: 'The geometry type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/>The list is <b>case sensitive</b> '
          schema:
            type: string
            enum: [Point (or) point, Polygon (or) polygon, LineString (or) linestring, bbox]

        - name: coordinates
          in: query
          description: 'The coordinates for a specific geometry query type. <br/> This parameter accepts both <b> one dimentional array and multi dimentional arrays </b> based on the <b> geometry</b> type. <br/> For e.g, [longitude-1,latitude-1] should be used for geometry <b>point</b>.  <br/>[[[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]]] should be used for geometry <b>polygon</b>. <br/> [[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]] should be used for geometry <b>bbox and linestring </b>. <br/> Maximum of 10 latitude, longitude pairs can be used for geometry <b>polygon, bbox and linestring </b>. <br/> Note: The data-type of this field is a string, therefore the coordinates are a string encoded multidimensional array.<br/> Maximum precision allowed is upto 6 decimal places.'
          schema:
            type: array
            minItems: 1
            maxItems: 10
            items:
              type: number
            format: double
        - name: maxDistance
          description: 'The maximum distance to be queried from center point in meters. <br/> This is applicable and is <b>mandatory</b> for <b>point</b> geometry.<br/> It should be used along with relation <b>near</b>.'
          schema:
            type: number
            minimum: 0
            maximum: 1000
          in: query
          required: false

        - name: q
          in: query
          description: 'The attribute query is used for querying <b> allowed quantitative</b> properties. <br/> Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. <br/> For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value, attribute != value and attribute == value. <br/> Allowed values for all operators is double. <br/> For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource.'
          schema:
            type: string
            maxLength: 512

        - name: attrs
          in: query
          description: 'The attrs parameter is used as an <b>application filter</b>. <br/> This is an optional parameter. It can be used to provide the list of attributes which the consumer expects to be responded by the server. <br/> The consumer is expected to provide <b>only</b> the attributes available in the <b>data descriptor</b> of the item in the DX(Data exchange) Catalogue. <br/> Minimum of 1 and a Maximum of 5 attributes can be provided in a comma separated fashion.'
          schema:
            type: string
            maxLength: 512

        - name: options
          in: query
          description: 'The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a spatial query. <br/> It should be used along with the <b> valid temporal query</b> or a <b> valid complex query</b>. <br/> It <b>cannot</b> be used along with a <b>attrs</b> filter. The value should be equal to `count` and it is <b>case sensitive</b>'
          schema:
            type: string
            enum: [count]

      responses:
        200:
          description: 'Successful query'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entityresponse'
        204:
          description: 'Empty Response'

        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'

      x-codeSamples:
        - lang: 'cURL'
          label: 'search by between'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=during&time=2020-10-18T14:20:00Z&endtime=2020-10-19T14:20:00Z' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'get encrypted data'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=during&time=2020-10-18T14:20:00Z&endtime=2020-10-19T14:20:00Z' \
            --header 'token: <tokenValue>' \
            --header 'publicKey: <publicKeyValue>'

        - lang: 'cURL'
          label: 'search by before'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=before&time=2020-10-19T12:00:00Z' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'search by after'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=after&time=2020-10-18T14:20:01Z' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'search by between and filter'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=between&time=2020-10-18T14:20:00Z&endtime=2020-10-19T14:20:00Z&attrs=id,currentLevel,referenceLevel' \
            --header 'token: <tokenValue>'        

        - lang: 'cURL'
          label: 'count by after'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&timerel=after&time=2020-10-18T14:20:01Z&options=count' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'complex search'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&geoproperty=location&georel=near;maxDistance=10&geometry=Point&coordinates=[21.178,72.834]&timerel=before&time=2020-10-19T14:00:00Z&attrs=id,location,speed' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'complex count'
          source: |
            curl --location -g --request GET 'https://example-proxy.com/ngsi-ld/v1/temporal/entities?id=UUID&geoproperty=location&georel=near;maxDistance=10&geometry=Point&coordinates=[21.178,72.834]&timerel=before&time=2020-10-19T14:00:00Z&options=count' \
            --header 'token: <tokenValue>'


      deprecated: false
      description: |
        The `/temporal/entities` end point allows a consumer to query on data published based on a <b>spatial</b>, <b>temporal</b> and <b>attribute</b> properties. The <b>spatial</b> queries should be submitted as a geo json as described in the API. All the queries requires a <b> valid data exchange</b> `id`  of the resource and a `temporal` parameter. These apis are intended to be used by DX(Data exchange) Data *Consumers*.

          - <b>Allowed Search Operations</b>: 
              - <b> Temporal Search : </b> which queries the temporal property of the resource.
              - <b> Spatial (Geo) Search : </b> which queries the geo property of the resource.
              - <b> Attribute Search : </b> which queries the valid attributes as per the data descriptor.
              - <b> Complex Search : </b> which queries using the combination of the above three.

        #### Temporal search
        Temporal search accepts time property based queries which are specified in ISO 8601 format. The params and their accepted values are -
          - <b>timerel</b>: The time relation of the query. Should be either `between`, `before` or `after`. The value `during` could also be used instead of `between`.
          - <b>time</b>: Start time for the temporal query in `ISO 8601` format. 
          - <b>endtime</b>: End time for the temporal query in `ISO 8601` format. Applicable only for `timerel = between`. 
          - Note, The time difference between `time` and `endtime` should be less than `10 days`. For `before` and `after` queries, `10 days` of data `before` or `after` the specified time will be provided.
        
        
        #### Spatial (Geo) Search
        Geo search accepts geojson based queries. The params and their accepted values are briefed below -
          - <b>geoproperty</b>: 
              - Specifies the name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>.
              - The current version of the API <b> mandates </b> it to be equal to `location`
          - <b>georel</b>:   
              - Specifies the spatial relationship to be queried.
              - The relation type of <b>geoquery</b> can be <b>one of</b> `near;maxdistance=<distance_in_meters>`, `within`, `intersects`.
              - The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property.
              - Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields.
              - The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.
              - The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.

          - <b>geometry</b>:  
              - Specifies the GeoJson geometries. 
              - Should be One of `Point`(equivalent for a circle), `Polygon`, `LineString`, `bbox`.
              - <b>Point</b>: Point and radius query
                  - coordinates: Specifies the  center point of the circle, for e.g, `[73,13]`. <br/>Note, format is [longitude, latitude]
                  - maxDistance: Specifies the Radius from the center point in meters, for e.g `100`. `maxValue` : 1000
                  - georel: In this version of DX(Data exchange) API, the allowed relationship search for a circle is `near` with a `maxdistance` in meters specified. This will be equivalent to a `within` query. Format is `near;maxdistance=<distance_in_meters>` 
              - <b>Polygon</b>: Polygon/Multi-Polygon query
                  - coordinates: Specifies the  coordinates of the polygon, for e.g, `[[[73,13],[73,12],[73,13]]]`.  <br/>Note, format is [longitude, latitude] and the first coordinate must be same as last. 
                  - `minNumberOfCoOrdinates` : 4 and `maxnNumberOfCoOrdinates` : 10
                  - georel: `within`, `intersects`
              - <b>LineString</b>: Multi line string
                  - coordinates: Specifies the coordinates of the multi-line, for e.g, `[[73,13],[74,15],[75,16]]`. <br/>Note, format is [longitude, latitude]
                  - `minNumberOfCoOrdinates` : 2 and `maxnNumberOfCoOrdinates` : 10
                  - georel:  `within`, `intersects`
              - <b>bbox</b>: Bounding box
                  - coordinates: `[[top-left],[bottom-right]]`. e.g, `[[73,13],[74,12]]`. <br/>Note, format is [longitude, latitude].
                  - georel:  `within`, `intersects`

        #### Attribute search
        The attribute query is used for querying <b> allowed quantitative</b> properties. 
          - Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. 
          - For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value and attribute == value. 
          - Allowed values for all operators is double. 
          - For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource. 
          - e.g, `q=attribute-name>attribute-value`

        #### Complex search
        A combination of the above is allowed to make searches more  complex.

        #### Filters
          - A subset of properties of returned documents can be filtered out. This is an option parameter. <br/>For e.g, `attrs=[id]` returns documents with only the `id` property retained in them. 
          - `minNumberOfAttributes` : 1 and `maxNumberOfAttributes` : 5 

        #### Options
          - The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a query. 
          - It should be used along with the <b> valid </b> `temporal`, or `complex` queries. 
          - It <b>cannot</b> be used along with a <b>attrs</b> filter. 
          - The value should be equal to `count` and it is <b>case sensitive</b>

  /entityOperations/query:
    post:
      tags:
        - Entities Post Query
      summary: Spatial search
      operationId: complex-query
      parameters:

        - name: token
          in: header
          description: A <b> valid data exchange Auth token </b> to process the request. <br/> This field is <b> mandatory </b> for accessing a <b> resource </b> .  <br/> If not provided with a valid token, user will be responded with <b> 401 Unauthorized </b> .
          required: true
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'


      x-codeSamples:
        - lang: 'cURL'
          label: 'Spatial complex query'
          source: |
            curl --location --request POST 'https://example-proxy.com/ngsi-ld/v1/entityOperations/query' \
            --header 'token: <tokenValue>' \
            --header 'Content-Type: application/json' \
            --data-raw '<payload>'

        - lang: 'cURL'
          label: 'get encrypted data'
          source: |
            curl --location --request POST 'https://example-proxy.com/ngsi-ld/v1/entityOperations/query' \
            --header 'token: <tokenValue>' \
            --header 'publicKey: <publicKeyValue>' \
            --header 'Content-Type: application/json' \
            --data-raw '<payload>'

      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/complex-geo-circle-filterrequest'
            example:
              type: Query
              entities:
                - id: UUID
              geoQ:
                geometry: Point
                coordinates: [21.178,72.834]
                georel: near;maxDistance=10
                geoproperty: location
        required: true

      responses:
        200:
          description: 'Successful query'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entityresponse'
        204:
          description: 'Empty Response'

        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'

      description: |
        The `/entityOperations/query` end point allows a consumer to query on data published based on a <b>spatial</b> and <b>attribute</b> properties. The <b>spatial</b> queries should be submitted as a geo json as described in the API. All the queries requires a <b> valid data exchange</b> `id` of the resource within the `entities` json object as per the schema. These apis are intended to be used by DX(Data exchange) Data *Consumers*.

          - <b>Allowed Search Operations</b>: 
              - <b> Spatial (Geo) Search : </b> which queries the geo property of the resource.
              - <b> Attribute Search : </b> which queries the valid attributes as per the data descriptor.
              - <b> Complex Search : </b> which queries using the combination of the above three.
        
        #### Spatial (Geo) Search
        Geo search accepts geojson based queries. The params and their accepted values are briefed below -
          - <b>geoproperty</b>: 
              - Specifies the name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>.
              - The current version of the API <b> mandates </b> it to be equal to `location`
          - <b>georel</b>:   
              - Specifies the spatial relationship to be queried.
              - The relation type of <b>geoquery</b> can be <b>one of</b> `near;maxdistance=<distance_in_meters>`, `within`, `intersects`.
              - The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property.
              - Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields.
              - The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.
              - The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.

          - <b>geometry</b>:  
              - Specifies the GeoJson geometries. 
              - Should be One of `Point`(equivalent for a circle), `Polygon`, `LineString`, `bbox`.
              - <b>Point</b>: Point and radius query
                  - coordinates: Specifies the  center point of the circle, for e.g, `[73,13]`. <br/>Note, format is [longitude, latitude]
                  - maxDistance: Specifies the Radius from the center point in meters, for e.g `100`. `maxValue` : 1000
                  - georel: In this version of DX(Data exchange) API, the allowed relationship search for a circle is `near` with a `maxdistance` in meters specified. This will be equivalent to a `within` query. Format is `near;maxdistance=<distance_in_meters>` 
              - <b>Polygon</b>: Polygon/Multi-Polygon query
                  - coordinates: Specifies the  coordinates of the polygon, for e.g, `[[[73,13],[73,12],[73,13]]]`.  <br/>Note, format is [longitude, latitude] and the first coordinate must be same as last. 
                  - `minNumberOfCoOrdinates` : 4 and `maxnNumberOfCoOrdinates` : 10
                  - georel: `within`, `intersects`
              - <b>LineString</b>: Multi line string
                  - coordinates: Specifies the coordinates of the multi-line, for e.g, `[[73,13],[74,15],[75,16]]`. <br/>Note, format is [longitude, latitude]
                  - `minNumberOfCoOrdinates` : 2 and `maxnNumberOfCoOrdinates` : 10
                  - georel:  `within`, `intersects`
              - <b>bbox</b>: Bounding box
                  - coordinates: `[[top-left],[bottom-right]]`. e.g, `[[73,13],[74,12]]`. <br/>Note, format is [longitude, latitude].
                  - georel:  `within`, `intersects`

        #### Attribute search
        The attribute query is used for querying <b> allowed quantitative</b> properties. 
          - Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`,`==` operators. 
          - For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value and attribute == value. 
          - Allowed values for all operators is double. 
          - For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource. 
          - e.g, `q=attribute-name>attribute-value`

        #### Complex search
        A combination of the above is allowed to make searches more  complex.

        #### Filters
          - A subset of properties of returned documents can be filtered out. This is an option parameter. <br/>For e.g, `attrs=[id]` returns documents with only the `id` property retained in them. 
          - `minNumberOfAttributes` : 1 and `maxNumberOfAttributes` : 5 

        #### Options
          - The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a query. 
          - It should be used along with the <b> valid </b> `temporal`, or `complex` queries. 
          - It <b>cannot</b> be used along with a <b>attrs</b> filter. 
          - The value should be equal to `count` and it is <b>case sensitive</b>

      deprecated: false

  /temporal/entityOperations/query:
    post:
      tags:
        - Entities Post Query
      summary: Spatial + temporal search
      operationId: spatial-complex-query
      parameters:

        - name: token
          in: header
          description: A <b> valid data exchange Auth token </b> to process the request. <br/> This field is <b> mandatory </b> for accessing a <b> resource </b> .  <br/> If not provided with a valid token, user will be responded with <b> 401 Unauthorized </b> .
          required: true
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'


      x-codeSamples:
        - lang: 'cURL'
          label: 'Spatial + temporal complex query'
          source: |
            curl --location --request POST 'https://example-proxy.com/ngsi-ld/v1/temporal/entityOperations/query' \
            --header 'token: <tokenValue>' \
            --header 'Content-Type: application/json' \
            --data-raw '<payload>'

        - lang: 'cURL'
          label: 'get encrypted data'
          source: |
            curl --location --request POST 'https://example-proxy.com/ngsi-ld/v1/temporal/entityOperations/query' \
            --header 'token: <tokenValue>' \
            --header 'publicKey: <publicKeyValue>' \
            --header 'Content-Type: application/json' \
            --data-raw '<payload>'


      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/complex-geo-circle-time-filterrequest'
            example:
              type: Query
              entities:
                - id: UUID
              geoQ:
                geometry: Point
                coordinates: [21.178,72.834]
                georel: near;maxDistance=1000
                geoproperty: location
              temporalQ:
                timerel: between
                time: 2020-06-01T14:20:00Z
                endtime: 2020-06-03T15:00:00Z
                timeProperty: observationDateTime
              q: speed>30.0
              attrs: id,speed

        required: true

      responses:
        200:
          description: 'Successful query'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entityresponse'
        204:
          description: 'Empty Response'

        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'

      description: |
        The `/temporal/entityOperations/query` end point allows a consumer to query on data published based on a <b>spatial</b>,<b> temporal </b> and <b>attribute</b> properties. The <b>spatial</b> queries should be submitted as a geo json as described in the API. All the queries requires a <b> valid data exchange</b> `id` of the resource within the `entities` json object as per the schema. These apis are intended to be used by DX(Data exchange) Data *Consumers*.

          - <b>Allowed Search Operations</b>:
              - <b> Temporal Search : </b> which queries the temporal property of the resource.
              - <b> Spatial (Geo) Search : </b> which queries the geo property of the resource.
              - <b> Attribute Search : </b> which queries the valid attributes as per the data descriptor.
              - <b> Complex Search : </b> which queries using the combination of the above three.
        
        #### Temporal search
        Temporal search accepts time property based queries which are specified in ISO 8601 format. The params and their accepted values are -
          - <b>timerel</b>: The time relation of the query. Should be either `between`, `before` or `after`.The value `during` could also be used instead of `between`.
          - <b>time</b>: Start time for the temporal query in `ISO 8601` format. 
          - <b>endtime</b>: End time for the temporal query in `ISO 8601` format. Applicable only for `timerel = between`. 
          - Note, The time difference between `time` and `endtime` should be less than `10 days`. For `before` and `after` queries, `10 days` of data `before` or `after` the specified time will be provided.
        
        #### Spatial (Geo) Search
        Geo search accepts geojson based queries. The params and their accepted values are briefed below -
          - <b>geoproperty</b>: 
              - Specifies the name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>.
              - The current version of the API <b> mandates </b> it to be equal to `location`
          - <b>georel</b>:   
              - Specifies the spatial relationship to be queried.
              - The relation type of <b>geoquery</b> can be <b>one of</b> `near;maxdistance=<distance_in_meters>`, `within`, `intersects`.
              - The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property.
              - Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields.
              - The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.
              - The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.

          - <b>geometry</b>:  
              - Specifies the GeoJson geometries. 
              - Should be One of `Point`(equivalent for a circle), `Polygon`, `LineString`, `bbox`.
              - <b>Point</b>: Point and radius query
                  - coordinates: Specifies the  center point of the circle, for e.g, `[73,13]`. <br/>Note, format is [longitude, latitude]
                  - maxDistance: Specifies the Radius from the center point in meters, for e.g `100`. `maxValue` : 1000
                  - georel: In this version of DX(Data exchange) API, the allowed relationship search for a circle is `near` with a `maxdistance` in meters specified. This will be equivalent to a `within` query. Format is `near;maxdistance=<distance_in_meters>` 
              - <b>Polygon</b>: Polygon/Multi-Polygon query
                  - coordinates: Specifies the  coordinates of the polygon, for e.g, `[[[73,13],[73,12],[73,13]]]`.  <br/>Note, format is [longitude, latitude] and the first coordinate must be same as last. 
                  - `minNumberOfCoOrdinates` : 4 and `maxnNumberOfCoOrdinates` : 10
                  - georel: `within`, `intersects`
              - <b>LineString</b>: Multi line string
                  - coordinates: Specifies the coordinates of the multi-line, for e.g, `[[73,13],[74,15],[75,16]]`. <br/>Note, format is [longitude, latitude]
                  - `minNumberOfCoOrdinates` : 2 and `maxnNumberOfCoOrdinates` : 10
                  - georel:  `within`, `intersects`
              - <b>bbox</b>: Bounding box
                  - coordinates: `[[top-left],[bottom-right]]`. e.g, `[[73,13],[74,12]]`. <br/>Note, format is [longitude, latitude].
                  - georel:  `within`, `intersects`

        #### Attribute search
        The attribute query is used for querying <b> allowed quantitative</b> properties. 
          - Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`,`==` operators. 
          - For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value and attribute == value. 
          - Allowed values for all operators is double. 
          - For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource. 
          - e.g, `q=attribute-name>attribute-value`

        #### Complex search
        A combination of the above is allowed to make searches more  complex.

        #### Filters
          - A subset of properties of returned documents can be filtered out. This is an option parameter. <br/>For e.g, `attrs=[id]` returns documents with only the `id` property retained in them. 
          - `minNumberOfAttributes` : 1 and `maxNumberOfAttributes` : 5 

        #### Options
          - The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a query. 
          - It should be used along with the <b> valid </b> `complex` queries. 
          - It <b>cannot</b> be used along with a <b>attrs</b> filter. 
          - The value should be equal to `count` and it is <b>case sensitive</b>
      deprecated: false

  /async/search:
    get:
      tags:
        - Async
      summary: Search
      operationId: async search
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: id
          in: query
          description: 'A <b> valid data exchange ID </b> of the resource. <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b> .'
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36
        - name: timerel
          in: query
          description: 'The temporal relation type of <b>timerel</b> to be performed.'
          #required: true
          schema:
            type: string
            enum: [ between, before, after ]
        - name: time
          in: query
          description: 'This parameter specifies the <b>start time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          #required: true
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          #required: true
          schema:
            type: string
        - name: geoproperty
          in: query
          description: 'Name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>. <br /> The current version of the API <b> mandates </b> it to be equal to `location`'
          schema:
            type: string
            enum: [ location ]
        - name: georel
          in: query
          description: 'The relation type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property. <br/> Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields. <br/> The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.  <br/> The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.'
          schema:
            type: string
            enum: [ near;maxdistance=<distance_in_meters>, within, intersects ]

        - name: geometry
          in: query
          description: 'The geometry type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/>The list is <b>case sensitive</b> '
          schema:
            type: string
            enum: [ Point (or) point, Polygon (or) polygon, LineString (or) linestring, bbox ]

        - name: coordinates
          in: query
          description: 'The coordinates for a specific geometry query type. <br/> This parameter accepts both <b> one dimentional array and multi dimentional arrays </b> based on the <b> geometry</b> type. <br/> For e.g, [longitude-1,latitude-1] should be used for geometry <b>point</b>.  <br/>[[[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]]] should be used for geometry <b>polygon</b>. <br/> [[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]] should be used for geometry <b>bbox and linestring </b>. <br/> Maximum of 10 latitude, longitude pairs can be used for geometry <b>polygon, bbox and linestring </b>. <br/> Note: The data-type of this field is a string, therefore the coordinates are a string encoded multidimensional array.<br/> Maximum precision allowed is upto 6 decimal places.'
          schema:
            type: array
            minItems: 1
            maxItems: 10
            items:
              type: number
            format: double
        - name: q
          in: query
          description: 'The attribute query is used for querying <b> allowed quantitative</b> properties. <br/> Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. <br/> For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value, attribute != value and attribute == value. <br/> Allowed values for all operators is double. <br/> For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource.'
          schema:
            type: string
            maxLength: 512
        - name: format
          in: header
          description: 'format in header could be added to get the response in required encoding through `/async/status` API'
          schema:
            type: string
            enum:  ["json", "csv"]
      x-codeSamples:
        - lang: 'cURL'
          label: 'async search'
          source: |
            curl --location --request GET 'https://example.com/ngsi-ld/v1/async/search?id=UUID&timerel=between&time=2020-10-10T14:20:00Z&endtime=2020-10-13T14:20:00Z' \
            --header 'token: <tokenValue>'

      responses:
        201:
          description: 'query submitted successfully'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/asyncsearchResponse'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/adapterBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'

        500:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/internalServerErrorResponse"
          description: 'Internal Server Error'

  /async/status:
    get:
      tags:
        - Async
      summary: Search status
      operationId: async search status
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: searchId
          in: query
          description: 'searchId returned while submitting request through `/async/search`'
          required: true
          schema:
            type: string
            maxLength: 512

      x-codeSamples:
        - lang: 'cURL'
          label: 'async status'
          source: |
            curl --location --request GET 'https://example.com/ngsi-ld/v1/async/status?searchID=sasdasd-asdasd-aasasd-dasdasd' \
            --header 'token: <tokenValue>'

      responses:
        200:
          description: 'search status'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/asyncsearchStatusComplete'
                  - $ref: '#/components/schemas/asyncsearchStatusInprogress'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/adapterBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'


  /consumer/audit:
    get:
      tags:
        - Metering
      summary: consumer search
      operationId: consumer search
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: options
          in: header
          description: 'options parameter is used for obtaining the number of hits for a query'
          style: simple
          schema:
            type: string
            enum: [count]
        - name: id
          in: query
          description: 'id of the resource in catalogue'
          schema:
            type: string
            format: uuid
            maxLength: 36
        - name: api
          in: query
          description: 'Valid DX(Data exchange) with api [`/entities`, `/temporal/entities`, `/entityOperation/Query`, `/temporal/entityOperation/Query`] having base path as prefix appended to api'
          schema:
            type: string
            maxLength: 512
        - name: timerel
          in: query
          description: 'The temporal relation type of <b>timerel</b> to be performed.'
          required: true
          schema:
            type: string
            enum: [between]
        - name: time
          in: query
          description: 'This parameter specifies the <b>start time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          required: true
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          required: true
          schema:
            type: string

      x-codeSamples:
        - lang: 'cURL'
          label: 'get data read query'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/consumer/audit?id=UUID&timerel=during&time=2022-11-20T14:20:00Z&endTime=2022-11-21T14:20:00Z&api=/ngsi-ld/v1/temporal/entities' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'get data count query'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/consumer/audit?id=UUID&timerel=during&time=2022-11-20T14:20:00Z&endTime=2022-11-21T14:20:00Z&api=/ngsi-ld/v1/entities' \
            --header 'token: <tokenValue>' \
            --header 'options: count'

      responses:
        200:
          description: 'search status'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/meteringApiResponse'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/adapterBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'
      description: Consumer API can be used by a user having consumer token to get audit details of API's.

  /provider/audit:
    get:
      tags:
        - Metering
      summary: provider search
      operationId: provider search
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: options
          in: header
          description: 'options parameter is used for obtaining the number of hits for a query'
          style: simple
          schema:
            type: string
            enum: [count]
        - name: id
          in: query
          description: 'id of the resource in catalogue'
          schema:
            type: string
            format: uuid
            maxLength: 36
        - name: api
          in: query
          description: 'Valid DX(Data exchange) api [`/entities`, `/temporal/entities`, `/entityOperation/Query`, `/temporal/entityOperation/Query`] having base path as prefix appended to api'
          schema:
            type: string
            maxLength: 512
        - name: timerel
          in: query
          description: 'The temporal relation type of <b>timerel</b> to be performed.'
          required: true
          schema:
            type: string
            enum: [between]
        - name: time
          in: query
          description: 'This parameter specifies the <b>start time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          required: true
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
          required: true
          schema:
            type: string
        - name: consumer
          in: query
          description: 'Id of consumer'
          schema:
            type: string
        - name: providerId
          in: query
          required: true
          description: 'Id of the provider'
          schema:
            type: string

      x-codeSamples:
        - lang: 'cURL'
          label: 'get data read query'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/provider/audit?id=UUID&timerel=during&time=2022-11-20T14:20:00Z&endTime=2022-11-21T14:20:00Z&api=/ngsi-ld/v1/entityOperations/query&providerID=UUID' \
            --header 'token: <tokenValue>'

        - lang: 'cURL'
          label: 'get data count query'
          source: |
            curl --location --request GET 'https://example-proxy.com/ngsi-ld/v1/provider/audit?id=UUID&timerel=during&time=2022-11-20T14:20:00Z&endTime=2022-11-21T14:20:00Z&api=/ngsi-ld/v1/entityOperations/query&providerID=UUID' \
            --header 'token: <tokenValue>' \
            --header 'options: count'

      responses:
        200:
          description: 'search status'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/meteringApiResponse'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/adapterBadRequestErrorResponse"
          description: 'Bad query'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
          description: 'Unauthorized'

        404:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/standardResourceNotFoundErrorResponse"
          description: 'Resource not found'
      description: Provider API can be used by a user having provider token to get audit details of API's.

  /summary:
    get:
      tags:
        - Metering
      summary: summary details
      operationId: summary details
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: starttime
          in: query
          description: 'This parameter specifies the <b>start time</b> for the summary-query in `ISO8601` format. <br/> Data exchange currently accepts `IST` and `UTC` time zones.'
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the summary-query in `ISO8601` format. <br/> Data exchange currently accepts `IST` and `UTC` time zones.'
          schema:
            type: string

      x-codeSamples:
        - lang: 'cURL'
          label: 'get query'
          source: |
            curl --location --request GET 'https://example.com/ngsi-ld/v1/summary?starttime=2022-11-20T14:20:00Z&endtime=2023-01-24T14:20:00Z' \
            --header 'token: <tokenValue>'

      responses:
        200:
          description: 'Summary details fetched successfully'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/summaryApiResponse'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/summaryBadRequestErrorResponse"
          description: 'Bad request'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/summaryInvalidTokenErrorResponse"
          description: |-
            - Unauthorized - `token` invalid/expired
            - Unauthorized - `clientId` & `clientSecret` invalid/not match

        204:
          description: 'Empty Response'
      description:  Summary API is used to get summary details and count for a given resource within the given time frame. The consumer could provide `starttime` and `endtime` and get the frequency usage of the resources.

  /overview:
    get:
      tags:
        - Metering
      summary: overview
      operationId: overview
      parameters:

        - name: token
          in: header
          description: 'data exchange auth token for accessing the API'
          required: true
          style: simple
          schema:
            type: string
            maxLength: 512
            pattern: '^[a-zA-Z0-9\/\@\.]*$'
        - name: starttime
          in: query
          description: 'This parameter specifies the <b>start time</b> for the overview-query in `ISO8601` format. <br/> Data exchange currently accepts `IST` and `UTC` time zones.'
          schema:
            type: string
        - name: endtime
          in: query
          description: 'This parameter specifies the <b>end time</b> for the overview-query in `ISO8601` format. <br/> Data exchange currently accepts `IST` and `UTC` time zones.'
          schema:
            type: string


      x-codeSamples:
        - lang: 'cURL'
          label: 'get query'
          source: |
            curl --location --request GET 'https://example.com/ngsi-ld/v1/overview?starttime=2022-11-20T14:20:00Z&endtime=2022-12-24T14:20:00Z' \
            --header 'token: <tokenValue>'

      responses:
        200:
          description: 'Overview details fetched successfully'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/overviewApiResponse'
        400:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/summaryBadRequestErrorResponse"
          description: 'Bad request'

        401:
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/summaryInvalidTokenErrorResponse"
          description: |-
            - Unauthorized - `token` invalid/expired
            - Unauthorized - `clientId` & `clientSecret` invalid/not match

      description: Overview API is used to get count based on month. Without parameter it will return last 12 months count data. This responds the number of times the API requests are made from DX Resource Server within the given time frame when the user specifies `starttime` and `endtime`.



components:

  schemas:

    geospatial-circlerequest:
      title: geospatial-circlerequest
      required:
        - type
        - entities
        - geoQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ'
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: Point
          coordinates:
            - 25.319768
            - 82.987988000000001
          georel: near;maxDistance=1000
          geoproperty: geoJsonLocation
    Entity:
      title: Entity
      required:
        - id
      type: object
      properties:
        id:
          type: string
          maxLength: 512
          description: 'A <b> valid data exchange ID </b> of the resource.  <br/> If the resource is a <b> protected resource </b> a <b> valid data exchange Auth token </b> is <b> mandatory </b>  in the header parameter of the request.  <br/> Information about the data exchange ID of the resource and security scope of the resource can be obtained from the <b> DX(Data exchange) catalogue server </b> .'
      example:
        id: UUID
    GeoQ:
      title: GeoQ
      required:
        - geometry
        - coordinates
        - georel
        - geoproperty
      type: object
      properties:
        geometry:
          type: string
          enum: [Point (or) point, Polygon (or) polygon, bbox, LineString (or) linestring]
          description: 'The geometry type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/>The list is <b>case sensitive</b>'
        coordinates:
          type: array
          minItems: 1
          maxItems: 10
          items:
            type: number
          description: 'The coordinates for a specific geometry query type. <br/> This parameter accepts both <b> one dimentional array and multi dimentional arrays </b> based on the <b> geometry</b> type. <br/> For e.g, [longitude-1,latitude-1] should be used for geometry <b>point</b>.  <br/>[[[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]]] should be used for geometry <b>polygon</b>. <br/> [[longitude-1,latitude-1], [longitude-2,latitude-2],...., [longitude-n,latitude-n]] should be used for geometry <b>bbox and linestring </b>. <br/> Maximum of 10 latitude, longitude pairs can be used for geometry <b>polygon, bbox and linestring </b>. <br/> Note: The data-type of this field is a string, therefore the coordinates are a string encoded multidimensional array. <br/> Maximum precision allowed is upto 6 decimal places.'
        georel:
          type: string
          enum: [within, contains, intersects]
          description: 'The relation type of <b>geoquery</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> The relation <b> near </b> should be always accomodated with a <b> maxdistance </b> property. <br/> Apart from <b> maxdistance</b> , all other fields in the Enum list are <b> case sensitive </b> fields. <br/> The relation <b> near;maxdistance </b> is applicable only for a <b> point </b>.  <br/> The relation <b> within </b> and  <b> intersects </b> are applicable only for <b> bbox, polygon and linestring</b>.'
        geoproperty:
          type: string
          enum: [location]
          description: 'Name of the <b> geospatial </b> property in the <b> DX(Data exchange) data descriptor </b>. <br /> The current version of the API <b> mandates </b> it to be equal to `location`'
      example:
        geometry: Point
        coordinates:
          - 25.319768
          - 82.987988000000001
        georel: near;maxDistance=1000
        geoproperty: geoJsonLocation
    geospatial-circlecount-request:
      title: geospatial-circle(count)request
      required:
        - type
        - entities
        - geoQ
        - options
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ'
        options:
          type: string
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: Point
          coordinates:
            - 25.319768
            - 82.987988000000001
          georel: near;maxDistance=100
          geoproperty: geoJsonLocation
        options: count
    geospatial-polygonrequest:
      title: geospatial-polygonrequest
      required:
        - type
        - entities
        - geoQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ2'
    GeoQ2:
      title: GeoQ2
      required:
        - geometry
        - coordinates
        - georel
        - geoproperty
      type: object
      properties:
        geometry:
          type: string
        coordinates:
          type: array
          items:
            type: array
            items:
              type: number
        georel:
          type: string
        geoproperty:
          type: string
    geospatial-linestringrequest:
      title: geospatial-linestringrequest
      required:
        - type
        - entities
        - geoQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ2'
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: linestring
          coordinates:
            - - 82.973500000000001
              - 25.3352
            - - 82.989400000000003
              - 25.345199999999998
            - - 82.989999999999995
              - 25.34
          georel: intersects
          geoproperty: geoJsonLocation
    geospatial-bboxrequest:
      title: geospatial-bboxrequest
      required:
        - type
        - entities
        - geoQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ2'
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: bbox
          coordinates:
            - - 82.950000000000003
              - 25.3567
            - - 83.005300000000005
              - 25
          georel: within
          geoproperty: geoJsonLocation
    responsefilterrequest:
      title: responsefilterrequest
      required:
        - type
        - entities
        - attrs
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        attrs:
          type: string
      example:
        type: Query
        entities:
          - id: UUID
        attrs: resource-id,latitude,longitude
    geospatial-circle-responsefilterrequest:
      title: geospatial-circle+responsefilterrequest
      required:
        - type
        - entities
        - geoQ
        - attrs
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ'
        attrs:
          type: string
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: Point
          coordinates:
            - 25.319768
            - 82.987988000000001
          georel: near;maxDistance=1000
          geoproperty: geoJsonLocation
        attrs: resource-id,longitude,latitude
    temporal-betweenrequest:
      title: temporal-betweenrequest
      required:
        - type
        - entities
        - temporalQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        temporalQ:
          $ref: '#/components/schemas/TemporalQ'
      example:
        type: Query
        entities:
          - id: UUID
        temporalQ:
          timerel: between
          time: 2020-06-01T14:20:00Z
          endtime: 2020-06-03T15:00:00Z
          timeProperty: timeProperty
    TemporalQ:
      title: TemporalQ
      required:
        - timerel
        - time
        - endtime
        - timeProperty
      type: object
      properties:
        timerel:
          type: string
          enum: [between, before, after]
          description: 'The temporal relation type of <b>timerel</b> to be performed. <br/> This <b>should</b> be one from the available options in the Enum list. <br/> If the relation is <b> between </b> it should be always accomodated with a <b> time </b> and <b> endtime </b> property.  <br/> If the relation is <b> before </b> or <b> after </b>it should be always accomodated <b> only</b> with a <b> time </b> property.'
        time:
          type: string
          description: 'This parameter specifies the <b>start time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query.'
        endtime:
          type: string
          description: 'This parameter specifies the <b>end time</b> for the temporal-query in `ISO8601` format. <br/> data exchange currently accepts `IST` and `UTC` time zones for the temporal query. <br/>If <b>timerel</b> is `between` time and endtime are mandatory'
        timeProperty:
          type: string
          enum: [observationDateTime]
      example:
        timerel: between
        time: 2020-06-01T14:20:00Z
        endtime: 2020-06-03T15:00:00Z
        timeProperty: observationDateTime
    time-beforerequest:
      title: time-beforerequest
      required:
        - type
        - entities
        - temporalQ
      type: object
      properties:
        type:
          type: string
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        temporalQ:
          $ref: '#/components/schemas/TemporalQ1'
      example:
        type: Query
        entities:
          - id: UUID
        temporalQ:
          timerel: before
          time: 2020-06-01T14:20:00Z
          timeProperty: timeProperty
    TemporalQ1:
      title: TemporalQ1
      required:
        - timerel
        - time
        - timeProperty
      type: object
      properties:
        timerel:
          type: string
        time:
          type: string
        timeProperty:
          type: string
      example:
        timerel: before
        time: 2020-06-01T14:20:00Z
        timeProperty: timeProperty
    complex-geo-circle-time-filterrequest:
      title: complex-geo-(circle)+time+filterrequest
      required:
        - type
        - entities
        - geoQ
        - temporalQ
        - attrs
      type: object
      properties:
        type:
          type: string
          enum: [Query]
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ'
        temporalQ:
          $ref: '#/components/schemas/TemporalQ'
        q:
          type: string
          maxLength: 512
          description: 'The attribute query is used for querying <b> allowed quantitative</b> properties. <br/> Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. <br/> For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value, attribute != value and attribute == value. <br/> Allowed values for all operators is double. <br/> For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource.'
        attrs:
          type: string
          maxLength: 512
          description: 'The attrs parameter is used as an <b>application filter</b>. <br/> This is an optional parameter. It can be used to provide the list of attributes which the consumer expects to be responded by the server. <br/> The consumer is expected to provide <b>only</b> the attributes available in the <b>data descriptor</b> of the item in the DX(Data exchange) Catalogue. <br/> Minimum of 1 and a Maximum of 5 attributes can be provided in a comma separated fashion.'
        options:
          type: string
          enum: [count]
          description: 'The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a spatial query. <br/> It should be used along with the <b> valid temporal query</b> or a <b> valid complex query</b>. <br/> It <b>cannot</b> be used along with a <b>attrs</b> filter. The value should be equal to `count` and it is <b>case sensitive</b>'
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: Point
          coordinates:
            - 25.319768
            - 82.987988000000001
          georel: near;maxDistance=1000
          geoproperty: geoJsonLocation
        temporalQ:
          timerel: between
          time: 2020-06-01T14:20:00Z
          endtime: 2020-06-03T15:00:00Z
          timeProperty: timeProperty
        attrs: resource-id,latitude,longitude

    complex-geo-circle-filterrequest:
      title: complex-geo-(circle)+filterrequest
      required:
        - type
        - entities
        - geoQ
        - temporalQ
        - attrs
      type: object
      properties:
        type:
          type: string
          enum: [Query]
        entities:
          type: array
          items:
            $ref: '#/components/schemas/Entity'
          description: ''
        geoQ:
          $ref: '#/components/schemas/GeoQ'
        q:
          type: string
          maxLength: 512
          description: 'The attribute query is used for querying <b> allowed quantitative</b> properties. <br/> Used to query on a value of a resource attribute using `<`,`>`,`<=`,`>=`,`!=`, `==` operators. <br/> For e.g, attribute > value, attribute < value, attribute >= value, attribute <= value, attribute != value and attribute == value. <br/> Allowed values for all operators is double. <br/> For the operator `==` if the query is on `id` then the only value allowed is an `data exchange ID` of a resource.'
        attrs:
          type: string
          maxLength: 512
          description: 'The attrs parameter is used as an <b>application filter</b>. <br/> This is an optional parameter. It can be used to provide the list of attributes which the consumer expects to be responded by the server. <br/> The consumer is expected to provide <b>only</b> the attributes available in the <b>data descriptor</b> of the item in the data exchange Catalogue. <br/> Minimum of 1 and a Maximum of 5 attributes can be provided in a comma separated fashion.'
        options:
          type: string
          enum: [count]
          description: 'The <b>options</b> parameter is used for obtaining the <b>number of hits</b> for a spatial query. <br/> It should be used along with the <b> valid temporal query</b> or a <b> valid complex query</b>. <br/> It <b>cannot</b> be used along with a <b>attrs</b> filter. The value should be equal to `count` and it is <b>case sensitive</b>'
      example:
        type: Query
        entities:
          - id: UUID
        geoQ:
          geometry: Point
          coordinates:
            - 25.319768
            - 82.987988000000001
          georel: near;maxDistance=1000
          geoproperty: geoJsonLocation
        attrs: resource-id,latitude,longitude


    entityresponse:
      title: entityresponse
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: Success
        results: [
          {
            "trip_direction": "NT",
            "trip_id": "24374871",
            "route_id": "17AD",
            "trip_delay": 948,
            "last_stop_arrival_time": "15:09:58",
            "actual_trip_start_time": "2020-11-03T14:22:30+05:30",
            "vehicle_label": "A09",
            "observationDateTime": "2020-11-03T15:12:08+05:30",
            "speed": 25.0,
            "license_plate": "GJ05BX1916",
            "last_stop_id": "2028",
            "location": {
              "coordinates": [
                72.870511,
                21.218943
              ],
              "type": "Point"
            },
            "id": "UUID"
          }
        ]
        limit: 5000
        offset: 0
        totalHits: 9091


    meteringApiResponse:
      title: meteringresponse
      required:
        - type
        - title
        - details
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: success
        results: [
          {
            "id": "UUID",
            "api": "/{basePath}/entities",
            "userid": "15c7506f-c800-48d6-adeb-0542b03947c6",
            "epochtime": 1655683200000,
            "resourceid": "34546554",
            "isotime": "456789",
            "providerid": "UUID",
            "size": 456
          }
        ]


    standardSuccessResponse:
      title: standardSuccessResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:success
        title: Success
        detail: Success

    standardBadRequestErrorResponse:
      title: standardBadRequestErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:badRequest
        title: Bad Request Data
        detail: Empty response | Missing/Invalid temporal parameters | Missing/Invalid geo parameters | Count is not supported with filtering

    standardInvalidTokenErrorResponse:
      title: standardInvalidTokenErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:invalidAuthorizationToken
        title: Invalid credentials
        detail: Invalid credentials

    standardResourceNotFoundErrorResponse:
      title: standardResourceNotFoundErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:resourceNotFound
        title: Not Found
        detail: Resource Not Found

    adapterBadRequestErrorResponse:
      title: adapterBadRequestErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:badRequest
        title: Bad Request Data
        detail: Missing/Invalid parameters

    asyncsearchResponse:
      title: asyncsearch
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: query submitted successfully
        results: [
          { "searchId": "asasdasd-asdasd-a353f-dasdas5"
          }
        ]

    internalServerErrorResponse:
      title: asyncsearch
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:badRequest
        title: Internal Server Error
        detail: Internal Server Error

    asyncsearchStatusComplete:
      title: complete
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: success
        results: [
          { "status": "COMPLETE",
            "progress": 100.00,
            "file-download-url": "https://example.com/filename",
            "searchId": "asasdasd-asdasd-aasasd-dasdasd",
            "userId": "aefvsdfsdf-exvsf-cezxcwscs-adasd"
          }
        ]

    asyncsearchStatusInprogress:
      title: inprogress
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: success
        results: [
          { "status": "IN_PROGRESS",
            "progress": 70.00,
            "searchId": "asasdasd-asdasd-aasasd-dasdasd",
            "userId": "aefvsdfsdf-exvsf-cezxcwscs-adasd"
          }
        ]

    summaryApiResponse:
      title: summaryresponse
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: success
        results: [
          {
            "resourceid": "UUID",
            "resource_label": "description",
            "publisher": "pune-env-flood",
            "publisher_id": "UUID",
            "city": "pune",
            "count": 19
          }
        ]

    overviewApiResponse:
      title: overview response
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        results:
          description: An array of objects
          type: array
          items:
            type: object
      example:
        type: urn:dx:rs:success
        title: success
        results: [
          {
            "month": "november",
            "year": "2022",
            "counts": 19
          },
          {
            "month": "december",
            "year": "2022",
            "counts": 156
          }
        ]

    summaryBadRequestErrorResponse:
      title: adapterBadRequestErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:backend
        title: bad request
        detail: bad request

    summaryInvalidTokenErrorResponse:
      title: standardInvalidTokenErrorResponse
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
      example:
        type: urn:dx:rs:invalidAuthorizationToken
        title: Not Authorized
        detail: Not Authorized