admin.selectSignals
Require access to Admin namespace
For an integration to access this method, it must have been granted access to the Admin namespace.
A resource select method for the signals resource. Associated items can be side-loaded.
Method parameters
Parameter | Properties | Description |
---|---|---|
integration Integration ID | required | The integration to select signals from. |
query Resource query | default={} | Resource query to select signals. |
include array(string(enum)) | default=[] | Relationships to include. Allow inclusion of "item" . |
groupIncludedByType bool | default=false | Alter result format to group included resources by type. |
Result
The result contains a JSON:API compatible resource selection result if groupIncludedByType
was set to false
.
type: object
Field | Description |
---|---|
meta Selection meta | Selection meta data. |
data array(Signal select) | Resource selection. |
included array(resource),map(string => array(resource)) | Side-loaded resources from relationships. |
Limits
Query:
query.limit
:- default is
20
. - maximum is
1000
.
- default is
Example
- cURL
- Python
- Go
The curl example uses Basic Auth for simplicity.
# 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.1beta2' \
--data \
'
{
"jsonrpc": "2.0",
"method": "admin.selectSignal",
"id": 10,
"params": {
"integration": "'${INTEGRATION_ID}'",
"query": {
"filter": {
"annotations.docs-clarify-io/example/name": "select_signals"
},
"limit": 10
},
"include": ["item"]
}
}
'
from pyclarify import Client, query
client = Client("./clarify-credentials.json")
filter = query.Filter(fields={
"annotations.clarify/clarify-go/example/name": query.Equal(value="save_signals")
})
response = client.select_signals(filter=filter, limit=10, include=["item"])
data = response.result.data
package main
import (
"context"
"encoding/json"
"os"
clarify "github.com/clarify/clarify-go"
"github.com/clarify/clarify-go/query"
)
func main() {
// To select or publish signals, you must grant the integration access to
// the "admin" namespace in the Clarify admin panel.
creds, err := clarify.CredentialsFromFile("clarify-credentials.json")
if err != nil {
panic(err)
}
ctx := context.Background()
client := creds.Client(ctx)
// For this example, the signals we want to select are created by the same
// integration that we are using to select them. Note that this isn't a
// requirement; for production cases, you may want this integration ID to be
// configured to be something else.
integrationID := creds.Integration
result, err := client.SelectSignals(integrationID).Filter(query.Comparisons{
"annotations.clarify/clarify-go/example/name": query.Equal("save_signals"),
}).Limit(10).Do(ctx)
if err != nil {
panic(err)
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
enc.Encode(result)
}