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( "item" )) | default=[] | Relationships to include. |
format Selection format | default={"dataAsArray":true,"groupIncludedByType":false} | Configure result format. |
Result
The result contains a JSON:API compatible resource selection result when groupIncludedByType
is set to false
.
type: object
Field | Description |
---|---|
meta Selection meta | Selection meta data. |
data array(Signal select),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.1' \
--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."annotations.docs-clarify-io/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
query := fields.Query().
Where(fields.Comparisons{"annotations.docs-clarify-io/example/name": fields.Equal("publish_signals")}).
Limit(10)
result, err := client.Clarify().SelectItems(query).Do(ctx)
if err != nil {
panic(err)
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
enc.Encode(result)
}