clarify.selectItems
Require access to Clarify namespace
For an integration to access this method, it must have been granted access to the Clarify namespace.
A resource select method for the items resource.
Method parameters
Parameter | Properties | Description |
---|---|---|
query Resource query | default={} | Resource query to select items. |
include array(string) | default=[] | Relationships to include. No inclusions provided. |
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(Item select),Item 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": "clarify.selectItems",
"id": 10,
"params": {
"integration": "'${INTEGRATION_ID}'",
"query": {
"filter": {
"annotations.docs-clarify-io/example/name": "publish_signals"
},
"limit": 10
}
}
}
'
from pyclarify import Client, query
client = Client("./clarify-credentials.json")
filter = query.Filter(fields={
"annotations.docs-clarify-io/example/name": query.Equal(value="publish_signals")
})
response = client.select_items(filter=filter, limit=10)
items = 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 item data or meta-data, you must enable access to the "clarify"
// namespace in clarify.
creds, err := clarify.CredentialsFromFile("clarify-credentials.json")
if err != nil {
panic(err)
}
ctx := context.Background()
client := creds.Client(ctx)
query := fields.Query().Where(query.Comparisons{
"annotations.docs-clarify-io/example/name": query.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)
}