integration.saveSignals
This call creates or updates a set of signals with the provided meta data. Each signal is uniquely identified by it's input ID in combination with the integration ID.
An integration can only interact with it's own signals using this call.
Example
- cURL
- Python
- Go
# BASIC_AUTH_USERNAME=<Username from Basic Auth credentials>
# BASIC_AUTH_PASSWORD=<Password from Basic Auth credentials>
# INTEGRATION_ID=${BASIC_AUTH_USERNAME}
curl -u ${BASIC_AUTH_USERNAME}:${BASIC_AUTH_PASSWORD} \
--request POST \
--url https://api.clarify.io/v1/rpc \
--header 'content-type: application/json' \
--header 'X-API-Version: 1.0' \
--data \
'
{
"jsonrpc": "2.0",
"method": "integration.SaveSignals",
"id": "1",
"params": {
"integration": "'${INTEGRATION_ID}'",
"inputs": {
"a" : {
"name": "Signal A",
"labels": {
"data-source": ["<your data-source name>"],
"location": ["<your location name>"]
}
}
}
}
}
'
from pyclarify.client import APIClient
from pyclarify.data import DataFrame
from datetime import datetime
client = APIClient(credentials=open("credentials.json"))
a = SignalInfo(
name="Signal A",
labels={"data-source": ["<your data-source name>"], "location": ["<your location name>"]},
)
b = SignalInfo(
name="Signal B",
labels={"data-source": ["<your data-source name>"], "location": ["<your location name>"]},
)
params = {"inputs": {"a": a , "b":b}, "createOnly": False}
client.save_signals(params= params)
package main
import (
"context"
clarify "github.com/clarify/clarify-go"
"github.com/clarify/clarify-go/resource"
)
func main() {
creds, err := clarify.CredentialsFromFile("credentials.json")
if err != nil {
panic(err)
}
ctx := context.Background()
client := creds.Client(ctx)
inputs := map[string]clarify.SignalSave{
"a": {
SignalAttributes: clarify.SignalAttributes{
Name: "Signal A",
Labels: resource.Labels{
"data-source": {"<your data-source name>"},
"location": {"<your location name>"},
},
},
},
"b": {
SignalAttributes: clarify.SignalAttributes{
Name: "Signal B",
Labels: resource.Labels{
"data-source": {"<your data-source name>"},
"location": {"<your location name>"},
},
},
},
}
if _, err := client.SaveSignals(inputs).Do(ctx); err != nil {
panic(err)
}
}
Method parameters
Name | Type | Required | Description |
---|---|---|---|
integration | Integration ID | Yes | The ID if the integration to save signal information for. |
inputs | map of Input ID => Signal save view | Yes | Desired signal information mapped by Input ID. |
createOnly | Boolean | No | If set to true , skip update of information for existing signals. That is, all Input IDs that map to existing signals are silently ignored. |
Response result
type: object
Properties
Name | Type | Presence | Description |
---|---|---|---|
signalsByInput | map of Input ID => Save summary | Yes | Save operation summary per input. |
Schema references
Save summary
type: object
Example
{
"id": "c9137visahsjsdhrim6g",
"created": true
}
Properties
Name | Type | Description |
---|---|---|
id | string | Unique ID of the saved resource entry. |
created | boolean | True if a new instance was created. |
Integration ID
Integration ID unqily identies a integration resourc entry.
type: string(regex: "^[a-v0-9]{20}$"
)
Input ID
Input ID routes data to a signal during insert. The input ID must be unique per integration only.
type: string(regex: ^[a-zA-Z0-9-_:.#+/]{1,128}$
)
Signal save view
The signal save view lists all writable signal fields. There are no required properties.
type: object
Example
signal example
{
"name": "Ice Cream Temperature",
"type": "numeric",
"description": "Temperature measurement of the ice cream",
"labels": {
"flavours": ["sweet", "sour"],
"location": ["pier", "banana stand"]
},
"engUnit": "°C",
"sourceType": "measurement",
"sampleInterval": "PT1M",
"gapDetection": "PT5M"
}
Properties
Name | Type | Default | Description |
---|---|---|---|
annotations | map of string(regex: "^[A-Za-z0-9-_/]{1,128}$" ) => string | {} | Arbitrary configuration parameters. Customer-provided annotations should use a relevant prefix, e.g. company-domain/application-name/ . |
name | string | Same as Input ID | The default signal display name. |
type | string(numeric or enum ) | numeric | The default signal type. |
description | string | "" | The default signal description |
labels | map of string(regex: "^[A-Za-z0-9-_/]{1,128}$" ) => array of string | {} | The default signal labels. |
engUnit | string | "" | Default signal display unit, used in numeric representations. |
enumValues | map of string(integer in range 0-9999 ) => string | {} | Default item enum values, used to replace numeric values with text in enumerated representations. |
sourceType | string("measurement" or "aggregation" or "prediction" ) | "measurement" | Default item source type. |
sampleInterval | null or string(RFC 3339 duration) | null | How often the signal is sampled (on average). |
gapDetection | null or string(RFC 3339 duration) | null | The default item gap detection. A gap will be drawn whenever there is no data for a duration longer than the specified value. |