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.1beta1' \
--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. |
Respoonse result
type: object
Properties
Name | Type | Presence | Description |
---|---|---|---|
signalsByInput | map of Input ID => Save summary | Yes | Save operation summary per input. |
Limits
Billing:
- Signals above the amount allowed by your selected plan, may be charged.
Schema references
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}$
)
Integration ID
Integration ID uniquely identities a integration resource entry.
type: string(regex: "^[a-v0-9]{20}$"
)
Save summary
type: object
Properties
Name | Type | Description |
---|---|---|
id | string | Unique ID of the saved resource entry. |
created | boolean | True if a new instance was created. |
Example
{
"id": "c9137visahsjsdhrim6g",
"created": true
}
Signal save view
The signal save view lists all writable signal fields. There are no required properties.
type: object
Properties
Name | Type | Properties | Description |
---|---|---|---|
annotations | map of string(regex: "^[A-Za-z0-9-_/]{1,128}$" ) => string | default = {} | Arbitrary configuration parameters. Customer-provided annotations should use a relevant prefix, e.g. company-domain/application-name/ . |
name | string | default to same as Input ID | The default signal display name. |
type | string(numeric or enum ) | default = numeric | The default signal type. |
description | string | default = "" | The default signal description |
labels | map of string(regex: "^[A-Za-z0-9-_/]{1,128}$" ) => array of string | default = {} | The default signal labels. |
engUnit | string | default = "" | Default signal display unit, used in numeric representations. |
enumValues | map of string(integer in range 0-9999 ) => string | default = {} | Default item enum values, used to replace numeric values with text in enumerated representations. |
sourceType | string("measurement" or "aggregation" or "prediction" ) | default = "measurement" | Default item source type. |
sampleInterval | null or string(RFC 3339 duration) | default = null | How often the signal is sampled (on average). |
gapDetection | null or string(RFC 3339 duration) | default = null | The default item gap detection. A gap will be drawn whenever there is no data for a duration longer than the specified value. |
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"
}