Getting Started

This section explains how to send JSON-formatted messages to the ScaleOut service using REST APIs.

Sending a Message

An HTTP client can be used to send messages to specific object instances so that they can be processed by a custom messaging module. For example, to send a temperature reading from a wind turbine to an instance identified as “turbine1” in a module called “windTurbine”, you could use curl from a bash shell as follows:

curl -X POST "https://localhost:8801/api/v1/Messages/windTurbine/turbine1?apiKey=1234567890ABCDEF" -H "Content-Type: application/json" -d "[{ 'temp': 65, 'timestamp': $(date +%s) }]"

Python can be used to make the same request:

import requests
import time
requests.post('https://localhost:8801/api/v1/Messages/windTurbine/turbine1?apiKey=1234567890ABCDEF', json={"temp": "65", "timestamp": time.time()})

Important

The JSON messages you send to the REST API must match the message type(s) that you defined in your Java/C# message-processing project. If your message-handling code relies on special JSON features (like C#’s [JsonDerivedType] attribute), be sure that your JSON payload includes the supporting properties required by those features.