Update a Block
Updates a Block or Page. Pages are supported only for SURVEY Studies, not IN_PRODUCT_SURVEY Studies. Replaces Block or Page skipLogic and displayLogic when those fields are sent. Omission preserves the stored group rules. A Page owns skip logic for its Questions, so Question skipLogic is rejected for Page members.
curl --request PATCH \
--url https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"name": "<string>",
"label": "<string>",
"displayLogic": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"skipLogic": [
{
"when": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"destination": {
"type": "END"
}
}
],
"randomizePosition": true,
"subsetCount": 2,
"displayAsPage": true
}
'import requests
url = "https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}"
payload = {
"name": "<string>",
"label": "<string>",
"displayLogic": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"skipLogic": [
{
"when": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"destination": { "type": "END" }
}
],
"randomizePosition": True,
"subsetCount": 2,
"displayAsPage": True
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
label: '<string>',
displayLogic: {
source: {
type: 'QUESTION_RESPONSE',
question: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: '<string>'}
},
value: '<string>'
},
skipLogic: [
{
when: {
source: {
type: 'QUESTION_RESPONSE',
question: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: '<string>'}
},
value: '<string>'
},
destination: {type: 'END'}
}
],
randomizePosition: true,
subsetCount: 2,
displayAsPage: true
})
};
fetch('https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}', 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.sprig.com/v2/studies/{studyId}/blocks/{blockId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'label' => '<string>',
'displayLogic' => [
'source' => [
'type' => 'QUESTION_RESPONSE',
'question' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>'
]
],
'value' => '<string>'
],
'skipLogic' => [
[
'when' => [
'source' => [
'type' => 'QUESTION_RESPONSE',
'question' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>'
]
],
'value' => '<string>'
],
'destination' => [
'type' => 'END'
]
]
],
'randomizePosition' => true,
'subsetCount' => 2,
'displayAsPage' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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.sprig.com/v2/studies/{studyId}/blocks/{blockId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
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.patch("https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}Authorizations
Headers
Body
Partial update for a Block or Page. Omitted fields preserve their current values.
How many eligible direct children to show each respondent. Null clears the subset. Omission on update preserves the stored value. Eligible children are the ones delivery can leave out: a prior skip destination, display logic, and either side of carry-forward stay in the survey and do not count. The value must be from 1 to one less than that eligible count. Setting it randomizes every direct child.
x >= 1Response
No Content
Was this page helpful?
curl --request PATCH \
--url https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"name": "<string>",
"label": "<string>",
"displayLogic": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"skipLogic": [
{
"when": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"destination": {
"type": "END"
}
}
],
"randomizePosition": true,
"subsetCount": 2,
"displayAsPage": true
}
'import requests
url = "https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}"
payload = {
"name": "<string>",
"label": "<string>",
"displayLogic": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"skipLogic": [
{
"when": {
"source": {
"type": "QUESTION_RESPONSE",
"question": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"value": "<string>"
},
"destination": { "type": "END" }
}
],
"randomizePosition": True,
"subsetCount": 2,
"displayAsPage": True
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
label: '<string>',
displayLogic: {
source: {
type: 'QUESTION_RESPONSE',
question: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: '<string>'}
},
value: '<string>'
},
skipLogic: [
{
when: {
source: {
type: 'QUESTION_RESPONSE',
question: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: '<string>'}
},
value: '<string>'
},
destination: {type: 'END'}
}
],
randomizePosition: true,
subsetCount: 2,
displayAsPage: true
})
};
fetch('https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}', 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.sprig.com/v2/studies/{studyId}/blocks/{blockId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'label' => '<string>',
'displayLogic' => [
'source' => [
'type' => 'QUESTION_RESPONSE',
'question' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>'
]
],
'value' => '<string>'
],
'skipLogic' => [
[
'when' => [
'source' => [
'type' => 'QUESTION_RESPONSE',
'question' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>'
]
],
'value' => '<string>'
],
'destination' => [
'type' => 'END'
]
]
],
'randomizePosition' => true,
'subsetCount' => 2,
'displayAsPage' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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.sprig.com/v2/studies/{studyId}/blocks/{blockId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
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.patch("https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies/{studyId}/blocks/{blockId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"label\": \"<string>\",\n \"displayLogic\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"skipLogic\": [\n {\n \"when\": {\n \"source\": {\n \"type\": \"QUESTION_RESPONSE\",\n \"question\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\"\n }\n },\n \"value\": \"<string>\"\n },\n \"destination\": {\n \"type\": \"END\"\n }\n }\n ],\n \"randomizePosition\": true,\n \"subsetCount\": 2,\n \"displayAsPage\": true\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}