openapi: 3.2.0 info: title: Platform Data API version: 1.31.0 description: User API for accessing platform data servers: - url: https://api.losant.com security: - bearerAuth: [] tags: - name: Data paths: /applications/{applicationId}/data/export: post: operationId: data.export summary: Creates a csv file from a query of devices and attributes over a time range tags: - Data parameters: - name: applicationId in: path required: true description: ID associated with the application schema: type: string pattern: ^[A-Fa-f\d]{24}$ example: 575ec8687ae143cd83dc4a97 responses: '202': description: If command was successfully sent content: application/json: schema: $ref: '#/components/schemas/jobEnqueuedResult' '400': description: Error if malformed request content: application/json: schema: $ref: '#/components/schemas/error' '404': description: Error if application was not found content: application/json: schema: $ref: '#/components/schemas/error' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/devicesDataExport' description: The query parameters x-losant-auth-scopes: - data.export /applications/{applicationId}/data/last-value-query: post: operationId: data.lastValueQuery summary: Returns the last known data for the given attribute tags: - Data parameters: - name: applicationId in: path required: true description: ID associated with the application schema: type: string pattern: ^[A-Fa-f\d]{24}$ example: 575ec8687ae143cd83dc4a97 responses: '200': description: Last known data for the requested attribute content: application/json: schema: $ref: '#/components/schemas/lastValueData' '400': description: Error if malformed request content: application/json: schema: $ref: '#/components/schemas/error' '404': description: Error if application was not found content: application/json: schema: $ref: '#/components/schemas/error' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/lastValueQuery' description: The query parameters x-losant-auth-scopes: - data.lastValueQuery /applications/{applicationId}/data/time-series-query: post: operationId: data.timeSeriesQuery summary: Returns the data for the given query tags: - Data parameters: - name: applicationId in: path required: true description: ID associated with the application schema: type: string pattern: ^[A-Fa-f\d]{24}$ example: 575ec8687ae143cd83dc4a97 responses: '200': description: Data for requested time range content: application/json: schema: $ref: '#/components/schemas/timeSeriesData' '400': description: Error if malformed request content: application/json: schema: $ref: '#/components/schemas/error' '404': description: Error if application was not found content: application/json: schema: $ref: '#/components/schemas/error' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/timeSeriesQuery' description: The query parameters x-losant-auth-scopes: - data.timeSeriesQuery components: schemas: timeSeriesData: title: Time Series Data description: Schema for the result of a time series query type: object properties: start: type: string format: date-time end: type: string format: date-time resolution: type: - number - 'null' aggregation: oneOf: - type: 'null' - oneOf: - type: string enum: - FIRST - LAST - COUNT - MAX - MIN - MEDIAN - MEAN - SUM - STD_DEV - type: string enum: - NONE - type: object properties: type: oneOf: - type: string enum: - FIRST - LAST - COUNT - MAX - MIN - MEDIAN - MEAN - SUM - STD_DEV - type: string enum: - NONE options: type: object additionalProperties: false additionalProperties: false required: - type - type: object properties: type: type: string enum: - TIMEATVALUE options: type: object properties: value: oneOf: - type: string maxLength: 255 - type: number - type: boolean additionalProperties: false required: - value additionalProperties: false required: - type - options limit: type: - number - 'null' order: type: string enum: - asc - desc devices: type: object patternProperties: ^[A-Fa-f\d]{24}$: type: object properties: name: type: string minLength: 1 maxLength: 255 tags: type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}$: type: array items: type: string minLength: 1 maxLength: 255 additionalProperties: false points: type: array items: type: object properties: time: type: string format: date-time data: type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}$: oneOf: - type: - number - string - boolean - type: object properties: value: type: - number - string - boolean sum: type: number count: type: number average: type: number variance: type: number additionalProperties: false additionalProperties: false additionalProperties: false required: - data - time additionalProperties: false required: - name - points - tags additionalProperties: false additionalProperties: false required: - start - end - resolution - aggregation - limit - order - devices error: title: Error description: Schema for errors returned by the API type: object properties: type: type: string message: type: string validationErrors: type: array items: type: object properties: field: type: string validationMessage: type: string jobEnqueuedResult: title: Job Enqueued API Result description: Schema for the result of a job being queued type: object properties: jobQueued: type: boolean enum: - true jobId: type: string maxLength: 24 success: type: boolean enum: - true timeSeriesQuery: title: Time Series Query description: Schema for the body of a time series query request type: object properties: start: type: number end: type: number duration: type: number resolution: type: number aggregation: oneOf: - oneOf: - type: string enum: - FIRST - LAST - COUNT - MAX - MIN - MEDIAN - MEAN - SUM - STD_DEV - type: string enum: - NONE - type: object properties: type: oneOf: - type: string enum: - FIRST - LAST - COUNT - MAX - MIN - MEDIAN - MEAN - SUM - STD_DEV - type: string enum: - NONE options: type: object additionalProperties: false additionalProperties: false required: - type - type: object properties: type: type: string enum: - TIMEATVALUE options: type: object properties: value: oneOf: - type: string maxLength: 255 - type: number - type: boolean additionalProperties: false required: - value additionalProperties: false required: - type - options attributes: type: array items: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ deviceIds: type: array items: type: string pattern: ^[A-Fa-f\d]{24}$ maxItems: 1000 deviceTags: type: array items: type: object properties: key: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ value: type: string minLength: 1 maxLength: 255 additionalProperties: false maxItems: 100 deviceQuery: $ref: '#/components/schemas/advancedDeviceQuery' limit: type: number order: type: string enum: - asc - desc default: asc additionalProperties: false devicesDataExport: title: Devices Data Export description: Schema for exporting the data for multiple devices type: object properties: email: type: string format: email maxLength: 1024 callbackUrl: type: string format: uri maxLength: 1024 deviceIds: type: array items: type: string pattern: ^[A-Fa-f\d]{24}$ maxItems: 1000 deviceTags: type: array items: type: object properties: key: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ value: type: string minLength: 1 maxLength: 255 additionalProperties: false maxItems: 100 deviceQuery: $ref: '#/components/schemas/advancedDeviceQuery' attributes: type: array maxItems: 256 items: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ start: type: number end: type: number options: type: object properties: includeDate: type: boolean default: true includeID: type: boolean default: true includeBlobData: type: boolean default: false filePerDevice: type: boolean default: false additionalProperties: false lastValueData: title: Last Value Data description: Schema for the result of a last value query type: object patternProperties: ^[A-Fa-f\d]{24}$: type: object properties: time: type: string format: date-time data: type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}$: type: - number - string - boolean additionalProperties: false additionalProperties: false required: - data - time additionalProperties: false advancedDeviceQuery: title: Advanced Device Query description: Schema for advanced device queries type: object properties: $and: type: array items: $ref: '#/components/schemas/advancedDeviceQuery' maxItems: 100 $or: type: array items: $ref: '#/components/schemas/advancedDeviceQuery' maxItems: 100 $nor: type: array items: $ref: '#/components/schemas/advancedDeviceQuery' maxItems: 100 id: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 creationDate: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false lastUpdated: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false deletedAt: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false name: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false deviceClass: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false gatewayId: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 parentId: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 ancestorId: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 attributeName: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false experienceUserId: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 experienceGroupId: oneOf: - oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' - type: object properties: $eq: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $ne: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lt: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $gte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $lte: oneOf: - type: string pattern: ^[A-Fa-f\d]{24}$ - type: 'null' $in: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ $nin: type: array maxItems: 100 items: type: string pattern: ^[A-Fa-f\d]{24}$ additionalProperties: false minProperties: 1 maxProperties: 1 tags: oneOf: - oneOf: - type: 'null' - type: object properties: $tagKey: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false $tagValue: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false minProperties: 1 - type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false - type: object properties: $eq: oneOf: - type: 'null' - type: object properties: $tagKey: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false $tagValue: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false minProperties: 1 - type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false required: - $eq additionalProperties: false - type: object properties: $ne: oneOf: - type: 'null' - type: object properties: $tagKey: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false $tagValue: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false minProperties: 1 - type: object patternProperties: ^[0-9a-zA-Z_-]{1,255}: oneOf: - type: string maxLength: 255 - type: 'null' - type: object properties: $in: type: array maxItems: 100 items: type: string maxLength: 255 required: - $in additionalProperties: false - type: object properties: $nin: type: array maxItems: 100 items: type: string maxLength: 255 required: - $nin additionalProperties: false additionalProperties: false required: - $ne additionalProperties: false disconnectedAt: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false connectedAt: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false connectionStatus: oneOf: - type: - string - number - boolean - 'null' - type: object properties: $eq: type: - string - number - boolean - 'null' $ne: type: - string - number - boolean - 'null' $gt: type: - string - number - boolean - 'null' $lt: type: - string - number - boolean - 'null' $gte: type: - string - number - boolean - 'null' $lte: type: - string - number - boolean - 'null' $startsWith: type: string minLength: 1 $endsWith: type: string minLength: 1 $contains: type: string minLength: 1 $ci: type: boolean $in: type: array maxItems: 100 items: type: - string - number - boolean $nin: type: array maxItems: 100 items: type: - string - number - boolean additionalProperties: false additionalProperties: false lastValueQuery: title: Last Value Query description: Schema for the body of a last value query request type: object properties: attribute: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ deviceIds: type: array items: type: string pattern: ^[A-Fa-f\d]{24}$ maxItems: 1000 deviceTags: type: array items: type: object properties: key: type: string pattern: ^[0-9a-zA-Z_-]{1,255}$ value: type: string minLength: 1 maxLength: 255 additionalProperties: false maxItems: 100 deviceQuery: $ref: '#/components/schemas/advancedDeviceQuery' end: type: number additionalProperties: false securitySchemes: bearerAuth: type: http scheme: bearer x-derived-from: format: bravado 1.0 by: all/0-working/bravado-to-openapi.py (roadmap#799) note: 'every action keeps its own path: resource.path + action.path'