DT Developer Docs
REST APIDT StudioStatus Page
  • Getting Started
  • Overview
  • Concepts
    • Devices
    • Events
    • Topics
      • Temperature Measurement Interval
      • Motion Sensor Activity Timer
  • Data Connectors
    • Introduction to Data Connectors
    • Creating a Data Connector
    • Configuring a Data Connector
    • Receiving Events
    • Best Practices
    • Example Integrations
      • Heroku
      • Google Cloud Functions
      • AWS Lambda
      • Azure HTTP Triggers
      • IBM Cloud Actions
    • Development Guides
      • Local Development with ngrok
  • REST API
  • Introduction to REST API
  • Explore Our Endpoints
    • with cURL
    • with Python API
    • with Postman
  • Authentication
    • OAuth2
    • Basic Auth
  • Error Codes
  • Emulator API
  • Examples
    • Pagination
    • Streaming Events
    • Touch to Identify
    • Refreshing Access Token
  • Reference
  • Status Page
  • Service Accounts
    • Introduction to Service Accounts
    • Creating a Service Account
    • Managing Access Rights
    • Permissions
    • Organizational Structures
  • Other
    • Application Notes
      • Generating a Room Temperature Heatmap
      • Modeling Fridge Content Temperatures
      • Outlier Detection on Multiple Temperature Sensors
      • Simple Temperature Forecasting for Substation Transformers
      • Sensor Data Insight with Power BI and Azure
      • Third-Party Sensor Data in DT Cloud
    • Frequently Asked Question
Powered by GitBook
On this page
  • Only subscribe to the events that are needed
  • Respond within 10 seconds
  • Use the eventId for deduplication
  • Use timestamp as a version for events
  • Use a valid SSL certificate issued by a well-known CA
  • Check the event type before processing the event
  • Disable Data Connector while not in use

Was this helpful?

  1. Data Connectors

Best Practices

Some Best Practices to keep in mind when implementing your endpoint.

Last updated 6 months ago

Was this helpful?

Only subscribe to the events that are needed

You should use the event filter of the Data Connector to only forward the event types you need. This will reduce the amount of work your server needs to do. See the page for more information.

Respond within 10 seconds

Your endpoint should complete its work and respond with a status code in the 2xx range within 10 seconds. If your endpoint takes much longer than this, it will be considered a failed delivery and will be retried according to the

If you think there's a possibility that your processing might take more than 10 seconds, prefer to write the event to a separate queue or a database and do the processing at a later point in time.

Use the eventId for deduplication

Your endpoint should be prepared to handle duplicate deliveries. While rare, in some scenarios, DT Cloud will forward the same event two or more times through a Data Connector. This can happen in scenarios such as network errors, timeouts, or other things where DT Cloud is not certain that the event has been correctly forwarded to your endpoint. This behavior is what provides an at-least-once guarantee for Data Connectors.

To make sure your endpoint is ready to handle these duplicate events, you should check the event.eventId field and check if it's an event you've already processed.

If a duplicate event is sent, it will often be sent within a few seconds of the original event. However, we can not provide any guarantees about the timing of these duplicates.

Use timestamp as a version for events

Similarly to the point above about handling duplicate events, there's also a possibility that events might be delivered out-of-order. If you're keeping track of the most recent events for each device, it is recommended that you use the timestamp of the event as a version. Only overwrite the event for a device if the timestamp is greater than the previous event you had stored.

Use a valid SSL certificate issued by a well-known CA

DT Cloud will always verify the SSL certificates of a URL before delivering events to it. The SSL certificate needs to be issued by one of the Certificate Authorities in . See the section for more information.

Check the event type before processing the event

Before you start decoding the event.data field of an event, you should make sure that the event you're processing is one of the expected event types by checking the event.eventType field. You should do this even if you're only subscribing to one event type. This way, your integration will not break or throw unexpected errors if you ever start subscribing to different event types, or if a new event type is added to the API.

Disable Data Connector while not in use

If you don't need a Data Connector for some time (for example if you're done with some testing), it's a good practice to disable it and then re-enable it when you need it again. This is because DT Cloud will automatically disable a Data Connector if it has had errors continuously for an extended time period (it will be set to the state SYSTEM_DISABLED). Disabling it yourself instead will give you more control over when this disabling happens, so you will not be caught by surprise that it's been disabled.

See more in the section for more information.

Configuring a Data Connector
Retry Policy
Mozilla's CA Certificate Program
Server Configuration
Auto-Disabling of Data Connectors