curl --request POST \
--url https://api.stackone.com/actions/rpc/synced \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "create_employee",
"path": {
"id": "123"
},
"query": {
"account_id": "abc"
},
"body": {
"search": "John"
},
"headers": {
"x-custom-header": "value"
},
"filter": {
"match": {
"description": "onboarding"
}
},
"search": "onboarding safety",
"sync_id": "sch_01J8Z3Q4",
"source": [
"first_name",
"email"
],
"sort": [
{
"last_name": "desc"
}
],
"aggs": {
"by_status": {
"terms": {
"field": "employment_status"
}
}
}
}
'import requests
url = "https://api.stackone.com/actions/rpc/synced"
payload = {
"action": "create_employee",
"path": { "id": "123" },
"query": { "account_id": "abc" },
"body": { "search": "John" },
"headers": { "x-custom-header": "value" },
"filter": { "match": { "description": "onboarding" } },
"search": "onboarding safety",
"sync_id": "sch_01J8Z3Q4",
"source": ["first_name", "email"],
"sort": [{ "last_name": "desc" }],
"aggs": { "by_status": { "terms": { "field": "employment_status" } } }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'create_employee',
path: {id: '123'},
query: {account_id: 'abc'},
body: JSON.stringify({search: 'John'}),
headers: {'x-custom-header': 'value'},
filter: {match: {description: 'onboarding'}},
search: 'onboarding safety',
sync_id: 'sch_01J8Z3Q4',
source: ['first_name', 'email'],
sort: [{last_name: 'desc'}],
aggs: {by_status: {terms: {field: 'employment_status'}}}
})
};
fetch('https://api.stackone.com/actions/rpc/synced', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stackone.com/actions/rpc/synced",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'create_employee',
'path' => [
'id' => '123'
],
'query' => [
'account_id' => 'abc'
],
'body' => [
'search' => 'John'
],
'headers' => [
'x-custom-header' => 'value'
],
'filter' => [
'match' => [
'description' => 'onboarding'
]
],
'search' => 'onboarding safety',
'sync_id' => 'sch_01J8Z3Q4',
'source' => [
'first_name',
'email'
],
'sort' => [
[
'last_name' => 'desc'
]
],
'aggs' => [
'by_status' => [
'terms' => [
'field' => 'employment_status'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stackone.com/actions/rpc/synced"
payload := strings.NewReader("{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stackone.com/actions/rpc/synced")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/actions/rpc/synced")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"datasync": {
"last_full_run_id": "<string>",
"last_run_id": "<string>",
"request_id": "<string>",
"synced_at": "<string>",
"sync_expires_at": "<string>",
"params_hash": "<string>",
"sync_id": "<string>",
"sync_name": "<string>"
},
"data": [
{}
],
"aggregations": {}
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Read synced action data from the datasync index
Returns previously synced data for an action, read from the Data Sync index rather than the provider. Responds with a refusal when no sync can be selected to serve the read.
curl --request POST \
--url https://api.stackone.com/actions/rpc/synced \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "create_employee",
"path": {
"id": "123"
},
"query": {
"account_id": "abc"
},
"body": {
"search": "John"
},
"headers": {
"x-custom-header": "value"
},
"filter": {
"match": {
"description": "onboarding"
}
},
"search": "onboarding safety",
"sync_id": "sch_01J8Z3Q4",
"source": [
"first_name",
"email"
],
"sort": [
{
"last_name": "desc"
}
],
"aggs": {
"by_status": {
"terms": {
"field": "employment_status"
}
}
}
}
'import requests
url = "https://api.stackone.com/actions/rpc/synced"
payload = {
"action": "create_employee",
"path": { "id": "123" },
"query": { "account_id": "abc" },
"body": { "search": "John" },
"headers": { "x-custom-header": "value" },
"filter": { "match": { "description": "onboarding" } },
"search": "onboarding safety",
"sync_id": "sch_01J8Z3Q4",
"source": ["first_name", "email"],
"sort": [{ "last_name": "desc" }],
"aggs": { "by_status": { "terms": { "field": "employment_status" } } }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'create_employee',
path: {id: '123'},
query: {account_id: 'abc'},
body: JSON.stringify({search: 'John'}),
headers: {'x-custom-header': 'value'},
filter: {match: {description: 'onboarding'}},
search: 'onboarding safety',
sync_id: 'sch_01J8Z3Q4',
source: ['first_name', 'email'],
sort: [{last_name: 'desc'}],
aggs: {by_status: {terms: {field: 'employment_status'}}}
})
};
fetch('https://api.stackone.com/actions/rpc/synced', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stackone.com/actions/rpc/synced",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'create_employee',
'path' => [
'id' => '123'
],
'query' => [
'account_id' => 'abc'
],
'body' => [
'search' => 'John'
],
'headers' => [
'x-custom-header' => 'value'
],
'filter' => [
'match' => [
'description' => 'onboarding'
]
],
'search' => 'onboarding safety',
'sync_id' => 'sch_01J8Z3Q4',
'source' => [
'first_name',
'email'
],
'sort' => [
[
'last_name' => 'desc'
]
],
'aggs' => [
'by_status' => [
'terms' => [
'field' => 'employment_status'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stackone.com/actions/rpc/synced"
payload := strings.NewReader("{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stackone.com/actions/rpc/synced")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/actions/rpc/synced")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"create_employee\",\n \"path\": {\n \"id\": \"123\"\n },\n \"query\": {\n \"account_id\": \"abc\"\n },\n \"body\": {\n \"search\": \"John\"\n },\n \"headers\": {\n \"x-custom-header\": \"value\"\n },\n \"filter\": {\n \"match\": {\n \"description\": \"onboarding\"\n }\n },\n \"search\": \"onboarding safety\",\n \"sync_id\": \"sch_01J8Z3Q4\",\n \"source\": [\n \"first_name\",\n \"email\"\n ],\n \"sort\": [\n {\n \"last_name\": \"desc\"\n }\n ],\n \"aggs\": {\n \"by_status\": {\n \"terms\": {\n \"field\": \"employment_status\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"datasync": {
"last_full_run_id": "<string>",
"last_run_id": "<string>",
"request_id": "<string>",
"synced_at": "<string>",
"sync_expires_at": "<string>",
"params_hash": "<string>",
"sync_id": "<string>",
"sync_name": "<string>"
},
"data": [
{}
],
"aggregations": {}
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Query Parameters
The number of results to return per page
25
The number of results to skip before returning results
0
Body
The action to execute
"create_employee"
Accepted for backwards compatibility but ignored on this endpoint: synced reads no longer select the run by path parameters. Use sync_id to choose which sync to read.
{ "id": "123" }
Accepted for backwards compatibility but ignored on this endpoint: synced reads no longer select the run by query parameters. Use sync_id to choose which sync to read.
{ "account_id": "abc" }
Accepted for backwards compatibility but ignored on this endpoint: synced reads no longer select the run by request body. Use sync_id to choose which sync to read.
{ "search": "John" }
Accepted for backwards compatibility but ignored on this endpoint: synced reads no longer select the run by headers. Use sync_id to choose which sync to read.
{ "x-custom-header": "value" }
OpenSearch-style filter (Query DSL) (term / terms / range / wildcard / match / match_phrase / exists / bool) over synced fields. match / match_phrase do word-level search (string fields only, case-insensitive); wildcard matches patterns (case-sensitive). Use field names exactly as returned in the action's "queryable_fields".
{ "match": { "description": "onboarding" } }
Free-text search over the record's text fields, ranked by relevance. Supports "quoted phrases", +required / -excluded terms, and prefix* — lenient (never errors). Combine with filter to narrow; results are relevance-ranked unless an explicit sort is given.
"onboarding safety"
Which sync to read, when the account has more than one sync of this action. Omit when there is only one. A named sync is never substituted if it is gone. Naming one that no longer exists is rejected with a 400.
"sch_01J8Z3Q4"
Field names to return (projection) — omit to return all fields. Shrinks the response.
["first_name", "email"]
OpenSearch-style sort. Each entry is either a field name (ascending) or an object keyed by field name: {"last_name": "desc"}, or the nested form {"last_name": {"order": "desc"}}. Earlier entries take priority.
[{ "last_name": "desc" }]
OpenSearch aggregations object. When set, aggregation results are returned instead of records, and source, sort, page_size and skip are ignored (filter still applies).
{
"by_status": { "terms": { "field": "employment_status" } }
}
Response
Synced action data, or a refusal payload explaining why none was returned.
- Option 1
- Option 2
Was this page helpful?