Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) IntakeQ: Send a QuestionnaireSee more IntakeQ ExamplesSend an intake package using the API. For more information, see https://support.intakeq.com/article/31-intakeq-api#send-questionnaire
integer li_rc oleobject loo_Http integer li_Success oleobject loo_Json oleobject loo_Resp oleobject loo_SbResponseBody oleobject loo_JResp integer li_RespStatusCode string ls_Text string ls_Answer string ls_QuestionType integer li_OfficeUse string ls_OfficeNote integer j integer li_Count_j string ls_Name string ls_DocumentType integer li_Signed string ls_Id string ls_ClientName string ls_ClientEmail integer li_ClientId string ls_Status integer li_DateCreated integer li_DateSubmitted string ls_QuestionnaireName string ls_Practitioner string ls_PractitionerName string ls_AppointmentId integer i integer li_Count_i // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Implements the following CURL command: // curl -H "Content-Type: application/json" \ // -H 'X-Auth-Key: xxxxxxxxxxxxxxxxxxxxxxxxx' \ // -X POST \ // -d '{ // "QuestionnaireId": "00000000-0000-0000-0000-000000000000", // "ClientId": 123, // "ClientName": "Dexter Morgan", // "ClientEmail": "dexter@email.com", // "ClientPhone": "2222222222", // "PractitionerId": "00000000-0000-0000-0000-000000000000", // }' https://intakeq.com/api/v1/intakes/send // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code // Use this online tool to generate code from sample JSON: // Generate Code to Create JSON // The following JSON is sent in the request body. // { // "QuestionnaireId": "00000000-0000-0000-0000-000000000000", // "ClientId": 123, // "ClientName": "Dexter Morgan", // "ClientEmail": "dexter@email.com", // "ClientPhone": "2222222222", // "PractitionerId": "00000000-0000-0000-0000-000000000000" // } loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("QuestionnaireId","00000000-0000-0000-0000-000000000000") loo_Json.UpdateInt("ClientId",123) loo_Json.UpdateString("ClientName","Dexter Morgan") loo_Json.UpdateString("ClientEmail","dexter@email.com") loo_Json.UpdateString("ClientPhone","2222222222") loo_Json.UpdateString("PractitionerId","00000000-0000-0000-0000-000000000000") loo_Http.SetRequestHeader("Content-Type","application/json") loo_Http.SetRequestHeader("X-Auth-Key","xxxxxxxxxxxxxxxxxxxxxxxxx") loo_Resp = loo_Http.PostJson3("https://intakeq.com/api/v1/intakes/send","application/json",loo_Json) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Json return end if loo_SbResponseBody = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder") loo_Resp.GetBodySb(loo_SbResponseBody) loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.LoadSb(loo_SbResponseBody) loo_JResp.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_JResp.Emit() li_RespStatusCode = loo_Resp.StatusCode Write-Debug "Response Status Code = " + string(li_RespStatusCode) if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Resp.Header Write-Debug "Failed." destroy loo_Resp destroy loo_Http destroy loo_Json destroy loo_SbResponseBody destroy loo_JResp return end if destroy loo_Resp // 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", // "Practitioner": "test@email.com", // "PractitionerName": "FirstName LastName", // "Questions": [ // { // "Id": "xxxx-1", // "Text": "Full name", // "Answer": "Dexter Morgan", // "QuestionType": "OpenQuestion", // "Rows": [ // ], // "ColumnNames": [ // ], // "OfficeUse": false, // "OfficeNote": "aaa" // }, // { // "Id": "xxxx-2", // "Text": "Full name", // "Answer": "Dexter Morgan", // "QuestionType": "OpenQuestion", // "Rows": [ // ], // "ColumnNames": [ // ], // "OfficeUse": false, // "OfficeNote": "aaa" // } // ], // "AppointmentId": "xxxxxxxx", // "ConsentForms": [ // { // "Id": "00000000-0000-0000-0000-000000000000", // "Name": "HIPAA Release Form", // "DocumentType": "Html", // "Signed": true, // "DateSubmitted": 1458526532654 // } // ] // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON ls_Id = loo_JResp.StringOf("Id") ls_ClientName = loo_JResp.StringOf("ClientName") ls_ClientEmail = loo_JResp.StringOf("ClientEmail") li_ClientId = loo_JResp.IntOf("ClientId") ls_Status = loo_JResp.StringOf("Status") li_DateCreated = loo_JResp.IntOf("DateCreated") li_DateSubmitted = loo_JResp.IntOf("DateSubmitted") ls_QuestionnaireName = loo_JResp.StringOf("QuestionnaireName") ls_Practitioner = loo_JResp.StringOf("Practitioner") ls_PractitionerName = loo_JResp.StringOf("PractitionerName") ls_AppointmentId = loo_JResp.StringOf("AppointmentId") i = 0 li_Count_i = loo_JResp.SizeOfArray("Questions") do while i < li_Count_i loo_JResp.I = i ls_Id = loo_JResp.StringOf("Questions[i].Id") ls_Text = loo_JResp.StringOf("Questions[i].Text") ls_Answer = loo_JResp.StringOf("Questions[i].Answer") ls_QuestionType = loo_JResp.StringOf("Questions[i].QuestionType") li_OfficeUse = loo_JResp.BoolOf("Questions[i].OfficeUse") ls_OfficeNote = loo_JResp.StringOf("Questions[i].OfficeNote") j = 0 li_Count_j = loo_JResp.SizeOfArray("Questions[i].Rows") do while j < li_Count_j loo_JResp.J = j j = j + 1 loop j = 0 li_Count_j = loo_JResp.SizeOfArray("Questions[i].ColumnNames") do while j < li_Count_j loo_JResp.J = j j = j + 1 loop i = i + 1 loop i = 0 li_Count_i = loo_JResp.SizeOfArray("ConsentForms") do while i < li_Count_i loo_JResp.I = i ls_Id = loo_JResp.StringOf("ConsentForms[i].Id") ls_Name = loo_JResp.StringOf("ConsentForms[i].Name") ls_DocumentType = loo_JResp.StringOf("ConsentForms[i].DocumentType") li_Signed = loo_JResp.BoolOf("ConsentForms[i].Signed") li_DateSubmitted = loo_JResp.IntOf("ConsentForms[i].DateSubmitted") i = i + 1 loop destroy loo_Http destroy loo_Json destroy loo_SbResponseBody destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.