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
(Visual FoxPro) 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
LOCAL loHttp LOCAL lnSuccess LOCAL loJson LOCAL loResp LOCAL loSbResponseBody LOCAL loJResp LOCAL lnRespStatusCode LOCAL lcText LOCAL lcAnswer LOCAL lcQuestionType LOCAL lnOfficeUse LOCAL lcOfficeNote LOCAL j LOCAL lnCount_j LOCAL lcName LOCAL lcDocumentType LOCAL lnSigned LOCAL lcId LOCAL lcClientName LOCAL lcClientEmail LOCAL lnClientId LOCAL lcStatus LOCAL lnDateCreated LOCAL lnDateSubmitted LOCAL lcQuestionnaireName LOCAL lcPractitioner LOCAL lcPractitionerName LOCAL lcAppointmentId LOCAL i LOCAL lnCount_i * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('Chilkat.Http') * 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" * } * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.UpdateString("QuestionnaireId","00000000-0000-0000-0000-000000000000") loJson.UpdateInt("ClientId",123) loJson.UpdateString("ClientName","Dexter Morgan") loJson.UpdateString("ClientEmail","dexter@email.com") loJson.UpdateString("ClientPhone","2222222222") loJson.UpdateString("PractitionerId","00000000-0000-0000-0000-000000000000") loHttp.SetRequestHeader("Content-Type","application/json") loHttp.SetRequestHeader("X-Auth-Key","xxxxxxxxxxxxxxxxxxxxxxxxx") loResp = loHttp.PostJson3("https://intakeq.com/api/v1/intakes/send","application/json",loJson) IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loJson CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbResponseBody = CreateObject('Chilkat.StringBuilder') loResp.GetBodySb(loSbResponseBody) * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJResp = CreateObject('Chilkat.JsonObject') loJResp.LoadSb(loSbResponseBody) loJResp.EmitCompact = 0 ? "Response Body:" ? loJResp.Emit() lnRespStatusCode = loResp.StatusCode ? "Response Status Code = " + STR(lnRespStatusCode) IF (lnRespStatusCode >= 400) THEN ? "Response Header:" ? loResp.Header ? "Failed." RELEASE loResp RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp CANCEL ENDIF RELEASE loResp * 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 lcId = loJResp.StringOf("Id") lcClientName = loJResp.StringOf("ClientName") lcClientEmail = loJResp.StringOf("ClientEmail") lnClientId = loJResp.IntOf("ClientId") lcStatus = loJResp.StringOf("Status") lnDateCreated = loJResp.IntOf("DateCreated") lnDateSubmitted = loJResp.IntOf("DateSubmitted") lcQuestionnaireName = loJResp.StringOf("QuestionnaireName") lcPractitioner = loJResp.StringOf("Practitioner") lcPractitionerName = loJResp.StringOf("PractitionerName") lcAppointmentId = loJResp.StringOf("AppointmentId") i = 0 lnCount_i = loJResp.SizeOfArray("Questions") DO WHILE i < lnCount_i loJResp.I = i lcId = loJResp.StringOf("Questions[i].Id") lcText = loJResp.StringOf("Questions[i].Text") lcAnswer = loJResp.StringOf("Questions[i].Answer") lcQuestionType = loJResp.StringOf("Questions[i].QuestionType") lnOfficeUse = loJResp.BoolOf("Questions[i].OfficeUse") lcOfficeNote = loJResp.StringOf("Questions[i].OfficeNote") j = 0 lnCount_j = loJResp.SizeOfArray("Questions[i].Rows") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("Questions[i].ColumnNames") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("ConsentForms") DO WHILE i < lnCount_i loJResp.I = i lcId = loJResp.StringOf("ConsentForms[i].Id") lcName = loJResp.StringOf("ConsentForms[i].Name") lcDocumentType = loJResp.StringOf("ConsentForms[i].DocumentType") lnSigned = loJResp.BoolOf("ConsentForms[i].Signed") lnDateSubmitted = loJResp.IntOf("ConsentForms[i].DateSubmitted") i = i + 1 ENDDO RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.