Creating a Device Simulator using REST API

Hi,

Is it possible to create a device simulator using REST API for the peripheral devices. I created a workflow to post a random number to the peripheral device as below

image .

So instead of this workflow I want to code it in python using REST APIs . Please clarify if this can be done using REST API provided by losant.

@Shiny_Josephine,

Hi! Welcome to the Losant Forums :slight_smile:

Just so I understand your question:

Option 1: Are you trying to write your own python script that simulates data and sends the data to Losant over HTTP?

If this is the case, I recommend using Webhooks. In your Python script, you can POST data to a webhook. That can trigger a workflow, and you’ll be able to use that data in your Device State Node.

Option 2: Or, are you trying to reach out to a REST API that simulates data and use that data in a Workflow?

If this is the case, you can use the HTTP Node to request your API and use that data in your workflow.

Let me know if this helps. I’m happy to answer more questions :slight_smile:

Instead of reinventing the wheel, you can check how existing simulators work with Losant, eg.

or