ptc-thingworx Properties API

Thing property read/write

OpenAPI Specification

ptc-thingworx-properties-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: PTC ThingWorx REST DataShapes Properties API
  description: PTC ThingWorx REST API provides programmatic access to the ThingWorx IoT platform including thing management, property read/write, service execution, event subscription, and mashup data APIs using Application Key or OAuth authentication. ThingWorx is PTC's industrial IoT platform for digital twin and connected factory applications.
  version: 9.5.0
  contact:
    name: PTC Support
    url: https://www.ptc.com/en/support
  license:
    name: PTC Software License
    url: https://www.ptc.com/en/legal-agreements
servers:
- url: https://{host}/Thingworx
  description: ThingWorx REST API
  variables:
    host:
      default: thingworx.example.com
      description: ThingWorx server hostname
security:
- appKey: []
- oauth2: []
tags:
- name: Properties
  description: Thing property read/write
paths:
  /Things/{thingName}/Properties:
    get:
      operationId: getThingProperties
      summary: Get all thing properties
      description: Returns the current values of all properties for a thing.
      tags:
      - Properties
      parameters:
      - $ref: '#/components/parameters/ThingName'
      responses:
        '200':
          description: Property values
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InfoTable'
        '404':
          $ref: '#/components/responses/NotFound'
  /Things/{thingName}/Properties/{propertyName}:
    get:
      operationId: getThingProperty
      summary: Get a thing property
      description: Returns the current value of a specific thing property.
      tags:
      - Properties
      parameters:
      - $ref: '#/components/parameters/ThingName'
      - $ref: '#/components/parameters/PropertyName'
      responses:
        '200':
          description: Property value
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PropertyValue'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      operationId: setThingProperty
      summary: Set a thing property
      description: Sets the value of a writable property on a thing.
      tags:
      - Properties
      parameters:
      - $ref: '#/components/parameters/ThingName'
      - $ref: '#/components/parameters/PropertyName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PropertySetRequest'
      responses:
        '200':
          description: Property updated
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    PropertySetRequest:
      type: object
      description: Request body for setting a property value
      properties:
        value:
          description: New property value (type must match property base type)
    PropertyValue:
      type: object
      description: A thing property current value
      properties:
        rows:
          type: array
          items:
            type: object
            properties:
              value:
                description: The property value (type depends on base type)
              timestamp:
                type: integer
                format: int64
                description: Value timestamp (epoch milliseconds)
              quality:
                type: string
                description: Quality string (GOOD, BAD, etc.)
    FieldDefinition:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        baseType:
          type: string
          enum:
          - STRING
          - INTEGER
          - LONG
          - NUMBER
          - BOOLEAN
          - DATETIME
          - JSON
          - INFOTABLE
          - THINGNAME
          - LOCATION
        ordinal:
          type: integer
        isPrimaryKey:
          type: boolean
    Error:
      type: object
      properties:
        Message:
          type: string
        Thread:
          type: string
        Code:
          type: integer
    DataShape:
      type: object
      description: A ThingWorx data shape definition
      properties:
        name:
          type: string
        description:
          type: string
        fieldDefinitions:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FieldDefinition'
    InfoTable:
      type: object
      description: ThingWorx InfoTable - the universal tabular data container
      properties:
        dataShape:
          $ref: '#/components/schemas/DataShape'
        rows:
          type: array
          items:
            type: object
            additionalProperties: true
  parameters:
    ThingName:
      name: thingName
      in: path
      required: true
      description: ThingWorx thing name
      schema:
        type: string
    PropertyName:
      name: propertyName
      in: path
      required: true
      description: ThingWorx property name
      schema:
        type: string
  responses:
    NotFound:
      description: Thing, property, or service not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    appKey:
      type: apiKey
      in: header
      name: appKey
      description: ThingWorx Application Key for authentication
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://thingworx.example.com/oauth/authorize
          tokenUrl: https://thingworx.example.com/oauth/token
          scopes:
            THINGWORX: Access ThingWorx REST API