Sample code for 30+ languages & platforms
Lua

IntakeQ: Query Intake Forms

See more IntakeQ Examples

Use this method to query client intake form summaries. The result set does not contain all the contents of the intake forms, but only their basic information (id, status, client info).

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.

local http = chilkat.Http.new()

-- Implements the following CURL command:

-- curl -X GET \
--   https://intakeq.com/api/v1/intakes/summary?client=[searchString]&startDate=[yyyy-MM-dd]&endDate=[yyyy-MM-dd]&page=[pageNumber]&all=[bool] \
--   -H 'X-Auth-Key: xxxxxxxxxxxxxxxxxxxxxxxxx'

-- Use the following online tool to generate HTTP code from a CURL command
-- Convert a cURL Command to HTTP Source Code

http:set_request_header("X-Auth-Key", "xxxxxxxxxxxxxxxxxxxxxxxxx")

local sbResponseBody = chilkat.StringBuilder.new()
local success = http:quick_get_sb("https://intakeq.com/api/v1/intakes/summary?client=[searchString]&startDate=[yyyy-MM-dd]&endDate=[yyyy-MM-dd]&page=[pageNumber]&all=[bool]", sbResponseBody)
if not success then
    print(http.last_error_text)
    return
end

local jarrResp = chilkat.JsonArray.new()
jarrResp:load_sb(sbResponseBody)
jarrResp.emit_compact = false

print("Response Body:")
print(jarrResp:emit())

local respStatusCode = http.last_status
print("Response Status Code = " .. respStatusCode)
if respStatusCode >= 400 then
    print("Response Header:")
    print(http.last_header)
    print("Failed.")
    return
end

-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)

-- [
--   {
--     "Id": "00000000-0000-0000-0000-000000000000",
--     "ClientName": "test",
--     "ClientEmail": "test@email.com",
--     "ClientId": 9999,
--     "Status": "Completed",
--     "DateCreated": 1458526480368,
--     "DateSubmitted": 1458526532654,
--     "QuestionnaireName": "test",
--     "QuestionnaireId": "1234acbd",
--     "Practitioner": "test@email.com",
--     "PractitionerName": "FirstName LastName"
--   },
--   {
--     "Id": "00000000-0000-0000-0000-000000000000",
--     "ClientName": "test",
--     "ClientEmail": "test@email.com",
--     "ClientId": 9999,
--     "Status": "Completed",
--     "DateCreated": 1458526480368,
--     "DateSubmitted": 1458526532654,
--     "QuestionnaireName": "test",
--     "QuestionnaireId": "1234acbd",
--     "Practitioner": "test@email.com",
--     "PractitionerName": "FirstName LastName"
--   }
-- ]

-- Sample code for parsing the JSON response...
-- Use the following online tool to generate parsing code from sample JSON:
-- Generate Parsing Code from JSON

local json
local Id = ""
local ClientName = ""
local ClientEmail = ""
local ClientId = 0
local Status = ""
local DateCreated = 0
local DateSubmitted = 0
local QuestionnaireName = ""
local QuestionnaireId = ""
local Practitioner = ""
local PractitionerName = ""

local i = 0
local count_i = jarrResp.size
while i < count_i do
    json = jarrResp:object_at(i)
    Id = json:string_of("Id")
    ClientName = json:string_of("ClientName")
    ClientEmail = json:string_of("ClientEmail")
    ClientId = json:int_of("ClientId")
    Status = json:string_of("Status")
    DateCreated = json:int_of("DateCreated")
    DateSubmitted = json:int_of("DateSubmitted")
    QuestionnaireName = json:string_of("QuestionnaireName")
    QuestionnaireId = json:string_of("QuestionnaireId")
    Practitioner = json:string_of("Practitioner")
    PractitionerName = json:string_of("PractitionerName")

    i = i + 1
end