API Client Functions
|
Purpose |
Reference the available classes and code examples in the CAREWare 6 API. |
|
Who should do this |
Developers and CAREWare administrators integrating applications through the API. |
|
Use this setup when |
Reviewing API classes, record operations, reports, attachments, and account functions. |
|
Main warning |
Examples contain sample credentials, placeholder functions, and potentially incomplete statements. Do not execute unchanged against production. |
|
Reference |
Before you begin
Confirm browser login and connectivity before testing an API client. Use a non-production environment, valid provider permissions, TLS where configured, and secure credentials. See API Introduction.
Original API class reference
This document outlines the available classes in the current version of the CAREWare 6 API. These classes all exist in the CWApi.vb file in the CW6ApiClient project of the sample application, which can be downloaded in the CW6APIDemo file here.
Classes:
ADAPEnrollment
This class provides methods for retrieving, adding, editing, and deleting ADAP Enrollment records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Dim emptyDoc as Dictionary(Of String, ezjson.JSONValue) =
CWApi.ADAPEnrollment.emptyCertification(sess)
CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue(Date.Today), "adp_en_hs_date")
CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue("01"), "adp_en_hs_adp_en_st_rfk")
Note: The following line assumes that there is a variable named clientPK that is set to a client's primary key
CWApi.ADAPEnrollment.addCertification(sess, clientPK, emptyDoc) CWApi.Session.Logout(sess)
AnnualScreening
This class provides methods for retrieving, adding, editing, and deleting Annual Screening records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Note: The following line assumes that there is a variable named clientPK that is set to a client's primary key
CWApi.AnnualScreening.addScreening(sess, clientPK, Date.Today,
"3AF46192-E55B-435E-9FF6-65BF3380C3A5",
"319523D8-0376-4B02-A57E-B893700B8808", "")CWApi.Session.Logout(sess)
CaseNotes
This class provides methods for retrieving, adding, editing, and deleting Case Notes.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Note: The following line assumes that there is a variable named clientPK that is set to a client's primary key
CWApi.CaseNotes.addCaseNote(sess, clientPK, Date.Today, "Test Case Note", "") CWApi.Session.Logout(sess)
Client
This class provides methods for finding, retrieving, adding, editing, and deleting client records.
Code Example for adding a client and setting the client id:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Dim clientPK as String = Guid.NewGuid.ToString()
CWApi.Client.addClient(sess, clientPK, "Fake", "", "Client", "1", "8/29/2005")
CWApi.Client.saveClientPersonalInfo(sess, clientPK, "", "Fake", "", "Client", "1", "8/29/2005", False, "New Client ID", "", "1") CWApi.Session.Logout(sess)
CommonStorage
This class provides methods for managing common storage values.
Code Example for getting and updating the minimum password length:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Dim oldLength as Integer = CInt(CWApi.CommonStorage.getCommonStorageNumber(sess,
"minimumPasswordLength")
CWApi.CommonStorage.setCommonStorageNumber(sess,
"minimumPasswordLength", 10) CWApi.Session.Logout(sess)
CustomFields
This class provides methods for managing custom fields and editing custom client tabs and custom subform records.
Code Example for adding a custom subform record to the default custom tab:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Dim emptyDoc as Dictionary(Of String, ezjson.JSONValue) =
CWApi.CustomFields.getEmptyCustomSubform(sess,
"86C5CF2D-4D65-4E6D-9854-1CA13A11E926") CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue(Date.Today), "cst_sb_date")
Note: The following line assumes that there is a variable named clientPK that is set to a client's primary key
CWApi.CustomFields.addCustomSubformRecord(sess, clientPK, emptyDoc) CWApi.Session.Logout(sess)
CustReport
This class provides methods for managing and running custom reports.
Code Example for running a custom report:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
getAReportKey is not a real function
Dim ReportPK As String = getAReportKey()
Dim reportStream as CWApi.CWFileStream = CWApi.CustReport.GerReportCSVStream (sess, ReportPK, Nothing, Date.Today()) reportStream.saveToFile ("C:\Reports\MyReport.csv") CWApi.Session.Logout(sess)
CwFileStream
This class provides methods for downloading report outputs or uploading and downloading attachments.
Code Example for uploading and downloading an attachment:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
getAContentType is a pseudo function.
Dim contentType as String = getAContentType()
gettAttachmentList is a pseudo function.
Dim attLsPK as string= getAttachmentList()
CW6HttpClient.CWApi.CustomFields.addAttachment(sess, clientPK, attLsPK, contentType, "C:\Attachments\ProofOfIncome.pdf", "")
pickAnAttachment is a pseudo function
Dim attachmentPK as string = pickAnAttachment()
Dim cwfs As Cw6HttpClient.CwApi.CwFileStream =
Cw6HttpClient.CwApi.CustomFields.getAttachmentFileStream (sessionVariables.session Info,attachmentPK)
Dim tempFolder As String = IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "temp")
If Not IO.Directory.Exists(tempFolder) Then
IO.Directory.CreateDirector (tempFolder)
End If
Dim fs As IO.FileStream
Try
DIm fileName as string = "ProofOfIncome.pdf",
fs = New IO.FileStream(IO.Path.Combine(tempFolder, fileName), IO.FileMode.Create)
cwfs.CopyTo(fs)
Catch ex As Exception
Throw ex
Finally
cwfs.Flush()
cwfs.Close()
If Not IsNothing(fs) Then
fs.Flush()
fs.Close()
End If
End Try
Open the attachment
Process.Start(IO.Path.Combine(tempFolder, fileName))
CWApi.Session.Logout(sess)
Eligibility
This class provides methods for viewing, adding, editing, and deleting eligibility records.
Code Example for adding an eligibility record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
Dim EligibilityData As Dictionary(Of String, ezjson.JSONValue) =
Cw6HttpClient.CwApi.Eligibility.getEmptyEligibilityRecord(sessionVariables.sessionInfo)
CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue(Date.Today), "EligibilityDate")
CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue("1"), "elg_yes_no_rfk")
CWApi.Doc.SetRowValForColumn(emptyDoc, new ezjson.JSONValue("FFFFFFFF-0000-0000-0000-000000000002"),
"elg_fnd_sr_fk") Cw6HttpClient.CwApi.Eligibility.addEligibilityRecord(sess, ClientPK, EligibilityData) CWApi.Session.Logout(sess)
InsuranceAssessment
This class provides methods for viewing, adding, editing, and deleting insurance assessment records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
Adds a Medicaid insurance record
Cw6HttpClient.CwApi.InsuranceAssessment.addInsuranceAssessment(sess, ClientPK, Date.Today, "3", False, False, False, False, False, False, True, False, False, False, False, "", False ) CWApi.Session.Logout(sess)
Lab
This class provides methods for viewing, adding, editing, and deleting lab records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
Adds a CD4 Count
Cw6HttpClient.CwApi.Lab.addLab(sess, ClientPK, Date.Today,
"FFFFFFFF-0000-0000-0000-000000000001", "=", 200,"") CWApi.Session.Logout(sess)
User
This class provides methods for managing user accounts.
Code Example for changing the current user's password:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
Cw6HttpClient.CwApi.User.ChangeMyPassword(sess,"N3WPa$$w0rd") CWApi.Session.Logout(sess)
Service
This class provides methods for viewing, adding, editing, and deleting service records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
pickAServiceType is a pseudo function
Dim serviceType as String = pickAServiceType()
pickAContract is a pseudo function
Dim contract as String = pickAContract()
Adds a CD4 Count
Cw6HttpClient.CwApi.Service.addService(sess,ClientPK,Date.Today, serviceType, 1, 5, 5, contract) CWApi.Session.Logout(sess)
PovertyLevel
This class provides methods for viewing, adding, editing, and deleting poverty level records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
Cw6HttpClient.CwApi.Service.addService (sess, ClientPK, Date.Today, 25000, 1, 25000) CWApi.Session.Logout(sess)
Referral
This class provides methods for viewing, adding, editing, and deleting referral records.
Code Example for adding a record:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
pickAProvider is a pseudo function
Dim referToProvider as String = pickAProvider()
pickAReferralClass is a pseudo function
Dim referralClass As String = pickAReferralClass()
Cw6HttpClient.CwApi.Service.addReferral (sess,ClientPK, Date.Today, "01,"1', referToProvider, "", "", "001", date.MinValue, "", "", False, referralClass) CWApi.Session.Logout(sess)
UserMessages
This class provides methods for sending user messages.
Code Example for sending a message:
Dim useTLS as Boolean = False
Dim serverName as String = "localhost"
Dim providerName as String = "default"
Dim sess as New CWApiSession(useTLS, serverName)
CWApi.Session.Login(sess, "cwtemp", "TEMPCW100", providerName)
pickAClient is a pseudo function
Dim clientPK as String = pickAClient()
pickAUser is a pseudo function
Dim sendToUser as String = pickAUser()
Cw6HttpClient.CwApi.Service.addReferral(sess,ClientPK, "Test Message", sendToUser) CWApi.Session.Logout(sess)
Important
The original examples above are preserved verbatim, including their sample login values, pseudo functions, unusual spellings, and apparent syntax inconsistencies. Treat them as reference excerpts, not validated production-ready code. Replace sample credentials and confirm method signatures in your installed CWApi.vb version before execution.
Helpful tips
• Test each operation against a non-production client and verify the returned record before enabling writes or deletes.
• Keep authentication details out of source control; use a protected secret store and grant the API account only necessary permissions.
• Validate provider scope and client primary keys before adding services, labs, referrals, or eligibility records.
• For custom reports, confirm report definitions, date ranges, filters, and provider scope before exporting data.
• For Common Storage changes, confirm whether the setting can be updated in the user interface and whether a Business Tier restart is required.
Related CAREWare guides and resources
|
Resource |
How it helps |
|
API architecture, connection requirements, and sample application. |
|
|
Manage and understand Common Storage settings. |
|
|
Define and validate report outputs. |
|
|
Run reports and check parameters. |
