Create questionnaire response
curl --request POST \
--url https://api.openloophealth.com/v0.1/questionnaire-responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"questionnaire_id": "<string>",
"answers": {},
"questionnaire_canonical": "<string>",
"encounter_id": "<string>",
"authored_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.openloophealth.com/v0.1/questionnaire-responses"
payload = {
"questionnaire_id": "<string>",
"answers": {},
"questionnaire_canonical": "<string>",
"encounter_id": "<string>",
"authored_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
questionnaire_id: '<string>',
answers: {},
questionnaire_canonical: '<string>',
encounter_id: '<string>',
authored_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.openloophealth.com/v0.1/questionnaire-responses', 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.openloophealth.com/v0.1/questionnaire-responses",
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([
'questionnaire_id' => '<string>',
'answers' => [
],
'questionnaire_canonical' => '<string>',
'encounter_id' => '<string>',
'authored_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.openloophealth.com/v0.1/questionnaire-responses"
payload := strings.NewReader("{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.openloophealth.com/v0.1/questionnaire-responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openloophealth.com/v0.1/questionnaire-responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"status": "in-progress",
"answers": {},
"questionnaire_id": "<string>",
"questionnaire_canonical": "<string>",
"subject": {
"id": "<string>",
"type": "<string>"
},
"encounter_id": "<string>",
"authored_at": "<string>",
"author": {
"id": "<string>",
"type": "<string>"
},
"source": {
"id": "<string>",
"type": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"error_code": "<string>"
},
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"error_code": "<string>"
},
"request_id": "<string>"
}Questionnaire Responses
Create questionnaire response
Submit a patient’s answers to a questionnaire; answers maps the questionnaire’s item link_ids to typed values. questionnaire_id is required and identifies the Questionnaire the response belongs to (get it from GET /questionnaires); if you also send questionnaire_canonical, it must reference that same Questionnaire (.../Questionnaire/<questionnaire_id>, version suffix allowed) or the request is rejected with a 400. Submitting as completed with a patient subject marks the intake complete and can trigger automation configured for your program (survey observations, lab requisitions). Refill requests work the same way: a refill is simply another questionnaire type, and the patient’s completed response is the refill application.
POST
/
questionnaire-responses
Create questionnaire response
curl --request POST \
--url https://api.openloophealth.com/v0.1/questionnaire-responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"questionnaire_id": "<string>",
"answers": {},
"questionnaire_canonical": "<string>",
"encounter_id": "<string>",
"authored_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.openloophealth.com/v0.1/questionnaire-responses"
payload = {
"questionnaire_id": "<string>",
"answers": {},
"questionnaire_canonical": "<string>",
"encounter_id": "<string>",
"authored_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
questionnaire_id: '<string>',
answers: {},
questionnaire_canonical: '<string>',
encounter_id: '<string>',
authored_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.openloophealth.com/v0.1/questionnaire-responses', 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.openloophealth.com/v0.1/questionnaire-responses",
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([
'questionnaire_id' => '<string>',
'answers' => [
],
'questionnaire_canonical' => '<string>',
'encounter_id' => '<string>',
'authored_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.openloophealth.com/v0.1/questionnaire-responses"
payload := strings.NewReader("{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.openloophealth.com/v0.1/questionnaire-responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openloophealth.com/v0.1/questionnaire-responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"questionnaire_id\": \"<string>\",\n \"answers\": {},\n \"questionnaire_canonical\": \"<string>\",\n \"encounter_id\": \"<string>\",\n \"authored_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"status": "in-progress",
"answers": {},
"questionnaire_id": "<string>",
"questionnaire_canonical": "<string>",
"subject": {
"id": "<string>",
"type": "<string>"
},
"encounter_id": "<string>",
"authored_at": "<string>",
"author": {
"id": "<string>",
"type": "<string>"
},
"source": {
"id": "<string>",
"type": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"error_code": "<string>"
},
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"error_code": "<string>"
},
"request_id": "<string>"
}Authorizations
serviceTokenuserToken
Body
application/json

