How to retrieve the final assessment score through the API
Syntax
- https://assessmentcenter.net/ac_api/2014-01/Results/{AssessmentOID} - returns the specified form as an html page
- https://assessmentcenter.net/ac_api/2014-01/Results/{AssessmentOID}.xml - returns the specified form in xml format
- https://assessmentcenter.net/ac_api/2014-01/Results/{AssessmentOID}.json - returns the specified form in json format
Remarks
AssessmentOID is the key returned from a call to the https://assessmentcenter.net/ac_api/2014-01/Assessments/{FormOID} API.
The last item administered (i.e. 'position' attribute) is the final score for the assessment.
T-Score = Theta * 10 + 50.0
Standard Error = StdError * 10
If no results are found for the AssessmentOID, the following response will return:
- JSON - {"Error":"No data found.", "UID":"","Name":"", "Items":[]}
- XML - <Form Error="No data found." UID="" Name=""></Form>
Sample code for https://assessmentcenter.net/ac_api/2014-01/Results
<script langauge="javascript" src="jquery-1.7.1.min.js"></script> <script language="javascript" src="crypto.js"></script> <script type='text/javascript' version='1.3'> var Server = https://assessmentcenter.net/ac_api; var AssessmentOID = "5CFBECB8-92E6-4220-90DD-FB1C4B4F7213"; // Sample assessment -- replace with your AssessmentOID function displayScore(AssessmentOID) { $.ajax({ url: Server + "Results/" + OID + ".json", cache: false, type: "POST", data: "", dataType: "json", beforeSend: function(xhr) { var reg = document.getElementById("txtRegistration").value; var token = document.getElementById("txtToken").value; var bytes = Crypto.charenc.Binary.stringToBytes(reg + ":" + token); var base64 = Crypto.util.bytesToBase64(bytes); xhr.setRequestHeader("Authorization", "Basic " + base64); }, success: function(data) { var container = document.getElementById("Content"); var _div2 = document.createElement("div"); _div2.appendChild(document.createTextNode("Form Order:" + AssessmentOID + "..." + "Status (" + data.Status + ")")); container.appendChild(_div2); var _div3 = document.createElement("div"); _div3.appendChild(document.createTextNode(" Theta (" + data.Theta + ") Error (" + data.StdError + ")")); container.appendChild(_div3); var _div8 = document.createElement("div"); _div8.appendChild(document.createTextNode(" ============================= ")); container.appendChild(_div8); for (var i=0; i < data.Items.length; i++) { var _div4 = document.createElement("div"); _div4.appendChild(document.createTextNode(" ID (" + data.Items[i].ID + ") Position (" + data.Items[i].Position + ")")); container.appendChild(_div4); var _div5 = document.createElement("div"); _div5.appendChild(document.createTextNode(" Theta (" + data.Items[i].Theta + ") Error (" + data.Items[i].StdError + ")")); container.appendChild(_div5); var _div6 = document.createElement("div"); var Item_text = ""; for (var j=0; j < data.Items[i].Elements.length; j++) { if (typeof(data.Items[i].Elements[j].Map) == 'undefined') { Item_text = Item_text + '\t' + data.Items[i].Elements[j].Description; } else { for (k=0; k< data.Items[i].Elements[j].Map.length; k++) { if (data.Items[i].Elements[j].Map[k].ItemResponseOID == data.Items[i].ItemResponseOID) { Item_text = Item_text + '\t\t[' + data.Items[i].Elements[j].Map[k].Description + '\t\t,' + data.Items[i].Elements[j].Map[k].Value +']'; } } } } _div6.appendChild(document.createTextNode(Item_text)); container.appendChild(_div6); var _div7 = document.createElement("div"); _div7.appendChild(document.createTextNode(" ============================= ")); container.appendChild(_div7); } }, error: function(jqXHR, textStatus, errorThrown) { alert('displayScore:' + jqXHR.responseText + ':' + textStatus + ':' + errorThrown); } }) }
Based on twillio example to call RESTful services. (http://www.twilio.com/docs/api/rest)
using System; using System.Collections; using System.Configuration; using System.IO; using System.Net; using System.Web; using System.Text; using System.Text.RegularExpressions; public class TestHarness { static void Main(string[] args) { string REGISTRATIONID ="31839849-ECE0-4F5E-BEAE-3D655ED65E31"; // Sample registration -- replace with your RegistrationOID string TOKEN ="F3738486-5A7D-41EF-8044-DCBAF800E2D4"; // Sample token -- replace with your TokenOID string AssessmentOID = "5CFBECB8-92E6-4220-90DD-FB1C4B4F7213"; // Sample assessment -- replace with your AssessmentOID string API_URL = "https://assessmentcenter.net/ac_api/2014-01/Results/" + AssessmentOID + ".xml"; string authstring = Convert.ToBase64String(Encoding.ASCII.GetBytes(String.Format("{0}:{1}", REGISTRATIONID, TOKEN))); ServicePointManager.Expect100Continue = false; Byte[] postbytes = Encoding.ASCII.GetBytes(string.Empty); WebClient client = new WebClient(); client.Headers.Add("Authorization", String.Format("Basic {0}", authstring)); client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); byte[] resp = client.UploadData(API_URL, "post", postbytes); Console.WriteLine(Encoding.ASCII.GetString(resp)); } }
// Requesting the scored Assessment after a user has finished
Request:https://assessmentcenter.net/ac_api/2014-01/Usage/Results/{AssessmentOID}.json
Response:
Request:https://assessmentcenter.net/ac_api/2014-01/Usage/Results/{AssessmentOID}.json
Response:
{ "UID": "", "Name": "PROMIS pediatric item bank for fatigue.", "Items": [ { "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "F200BC59-202C-4EC6-89D9-5B81E07BFC44", "ID": "4221R1", "Position": "5", "StdError": "0.388278457531381", "Theta": "0.995851885904856", "Elements": [ { "ElementOID": "8AB8BA58-3BB0-40B6-B656-C24F1169069B", "Description": "In the past 7 days", "ElementOrder": "1" }, { "ElementOID": "C7B9484D-E07F-445B-B2F3-DEA2CDE0DDC6", "Description": "I had trouble finishing things because I was too tired.", "ElementOrder": "2" }, { "ElementOID": "C08BDEB7-358E-4CB6-BD43-54A234D2D75A", "Description": "ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A", "ElementOrder": "3", "Map": [ { "ElementOID": "00483AA5-3F7A-47A7-85ED-B8158CAD3441", "Description": "Never", "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "EF77F877-6158-47D7-B767-A3C761C88C0A", "Value": "1", "Position": "1" }, { "ElementOID": "463E034D-37AD-4B0B-836D-E8739DD54B48", "Description": "Almost Never", "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "2D0334D3-A62D-456B-A374-8279D97AEFBF", "Value": "2", "Position": "2" }, { "ElementOID": "025469C3-CDE6-480C-99B9-33DF319C369A", "Description": "Sometimes", "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "F200BC59-202C-4EC6-89D9-5B81E07BFC44", "Value": "3", "Position": "3" }, { "ElementOID": "2B092F99-1551-4871-8D42-6AD280AFEB33", "Description": "Often", "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "F1481F76-1699-412A-87CF-DA2471D042DD", "Value": "4", "Position": "4" }, { "ElementOID": "DA3C4987-6335-448E-A95F-855BD4ED0276", "Description": "Almost Always", "FormItemOID": "20C684DA-4158-4EEE-B049-016EF5912BD4", "ItemResponseOID": "41A8A21A-68CE-4096-A0D4-965D81FEAB1B", "Value": "5", "Position": "5" } ] } ] }, { "FormItemOID ..." } ] }
// Requesting the scored Assessment after a user has finished
Request:https://assessmentcenter.net/ac_api/2014-01/Usage/Results/{AssessmentOID}.xml
Response:
Request:https://assessmentcenter.net/ac_api/2014-01/Usage/Results/{AssessmentOID}.xml
Response:
<Form UID="" Name="PROMIS pediatric item bank for fatigue."> <Item FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="F200BC59-202C-4EC6-89D9-5B81E07BFC44" ID="4221R1" Position="5" StdError="0.388278457531381" Theta="0.995851885904856"> <Element ElementOID="8AB8BA58-3BB0-40B6-B656-C24F1169069B" Description="In the past 7 days" ElementOrder="1" /> <Element ElementOID="C7B9484D-E07F-445B-B2F3-DEA2CDE0DDC6" Description="I had trouble finishing things because I was too tired." ElementOrder="2" /> <Element ElementOID="C08BDEB7-358E-4CB6-BD43-54A234D2D75A" Description="ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A" ElementOrder="3"> <Map ElementOID="00483AA5-3F7A-47A7-85ED-B8158CAD3441" Description="Never" FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="EF77F877-6158-47D7-B767-A3C761C88C0A" Value="1" Position="1" /> <Map ElementOID="463E034D-37AD-4B0B-836D-E8739DD54B48" Description="Almost Never" FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="2D0334D3-A62D-456B-A374-8279D97AEFBF" Value="2" Position="2" /> <Map ElementOID="025469C3-CDE6-480C-99B9-33DF319C369A" Description="Sometimes" FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="F200BC59-202C-4EC6-89D9-5B81E07BFC44" Value="3" Position="3" /> <Map ElementOID="2B092F99-1551-4871-8D42-6AD280AFEB33" Description="Often" FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="F1481F76-1699-412A-87CF-DA2471D042DD" Value="4" Position="4" /> <Map ElementOID="DA3C4987-6335-448E-A95F-855BD4ED0276" Description="Almost Always" FormItemOID="20C684DA-4158-4EEE-B049-016EF5912BD4" ItemResponseOID="41A8A21A-68CE-4096-A0D4-965D81FEAB1B" Value="5" Position="5" /> </Element> </Item> <Item FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="B3FD9B69-9C08-4EEC-9A9D-1ECFF8A65134" ID="4239aR2" Position="4" StdError="0.422481631596192" Theta="1.05073481547472"> <Element ElementOID="8AB8BA58-3BB0-40B6-B656-C24F1169069B" Description="In the past 7 days" ElementOrder="1" /> <Element ElementOID="358D86A2-B3B2-48D7-8111-54CA5CE3F430" Description="Being tired made it hard for me to keep up with my schoolwork." ElementOrder="2" /> <Element ElementOID="C08BDEB7-358E-4CB6-BD43-54A234D2D75A" Description="ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A" ElementOrder="3"> <Map ElementOID="00483AA5-3F7A-47A7-85ED-B8158CAD3441" Description="Never" FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="64946A9E-AF7D-4E53-89A4-934A0B4B05D3" Value="1" Position="1" /> <Map ElementOID="463E034D-37AD-4B0B-836D-E8739DD54B48" Description="Almost Never" FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="7F0ACCFF-551C-43A4-958F-84CB347D936C" Value="2" Position="2" /> <Map ElementOID="025469C3-CDE6-480C-99B9-33DF319C369A" Description="Sometimes" FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="B3FD9B69-9C08-4EEC-9A9D-1ECFF8A65134" Value="3" Position="3" /> <Map ElementOID="2B092F99-1551-4871-8D42-6AD280AFEB33" Description="Often" FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="90615DBB-BF4D-4F79-AC0C-1472C1D27753" Value="4" Position="4" /> <Map ElementOID="DA3C4987-6335-448E-A95F-855BD4ED0276" Description="Almost Always" FormItemOID="7EB6A435-2C6E-406B-B9FB-549AD797486F" ItemResponseOID="27074DBE-B1BA-4457-9DDB-A8504200E91C" Value="5" Position="5" /> </Element> </Item> <Item FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="8D63A6E7-8873-4270-9991-12AEDDFF5866" ID="4220R1" Position="3" StdError="0.47531556807558" Theta="1.04632365296833"> <Element ElementOID="8AB8BA58-3BB0-40B6-B656-C24F1169069B" Description="In the past 7 days" ElementOrder="1" /> <Element ElementOID="833D7594-2FFC-4C8C-82A0-F49A97C9515C" Description="I had trouble starting things because I was too tired." ElementOrder="2" /> <Element ElementOID="C08BDEB7-358E-4CB6-BD43-54A234D2D75A" Description="ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A" ElementOrder="3"> <Map ElementOID="00483AA5-3F7A-47A7-85ED-B8158CAD3441" Description="Never" FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="A9D7827B-5C9D-4AE6-ACF4-1B9D1CC5C70F" Value="1" Position="1" /> <Map ElementOID="463E034D-37AD-4B0B-836D-E8739DD54B48" Description="Almost Never" FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="E319590B-0116-49B9-A63A-8FD46B18DAF3" Value="2" Position="2" /> <Map ElementOID="025469C3-CDE6-480C-99B9-33DF319C369A" Description="Sometimes" FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="8D63A6E7-8873-4270-9991-12AEDDFF5866" Value="3" Position="3" /> <Map ElementOID="2B092F99-1551-4871-8D42-6AD280AFEB33" Description="Often" FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="CD5C46C6-89CB-4394-B876-E5115300C0A0" Value="4" Position="4" /> <Map ElementOID="DA3C4987-6335-448E-A95F-855BD4ED0276" Description="Almost Always" FormItemOID="F66C58B5-344F-4B52-B49C-59C20D3EA357" ItemResponseOID="178BB021-DEC7-4EDB-9A95-1C2D50ABBE6D" Value="5" Position="5" /> </Element> </Item> <Item FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="FB59D0A2-30C8-4D6C-BDD9-2A4E44618A4C" ID="4212R1" Position="2" StdError="0.551677792094496" Theta="1.04082353446704"> <Element ElementOID="8AB8BA58-3BB0-40B6-B656-C24F1169069B" Description="In the past 7 days" ElementOrder="1" /> <Element ElementOID="ECD416F4-EA58-48B7-9900-7275B6D5C526" Description="Being tired made it hard for me to play or go out with my friends as much as I'd like." ElementOrder="2" /> <Element ElementOID="C08BDEB7-358E-4CB6-BD43-54A234D2D75A" Description="ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A" ElementOrder="3"> <Map ElementOID="00483AA5-3F7A-47A7-85ED-B8158CAD3441" Description="Never" FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="CD017586-0F65-47EC-8D87-F53115B26AB1" Value="1" Position="1" /> <Map ElementOID="463E034D-37AD-4B0B-836D-E8739DD54B48" Description="Almost Never" FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="90A85BA5-1C0F-41D4-ADAE-2DE9E8A795CE" Value="2" Position="2" /> <Map ElementOID="025469C3-CDE6-480C-99B9-33DF319C369A" Description="Sometimes" FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="FB59D0A2-30C8-4D6C-BDD9-2A4E44618A4C" Value="3" Position="3" /> <Map ElementOID="2B092F99-1551-4871-8D42-6AD280AFEB33" Description="Often" FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="1D9A9CCC-2E70-4EFA-B022-8BEA4FA1DE81" Value="4" Position="4" /> <Map ElementOID="DA3C4987-6335-448E-A95F-855BD4ED0276" Description="Almost Always" FormItemOID="EC013DAE-8F22-4DBE-864E-45F6021F50EE" ItemResponseOID="C795D448-1FAE-4BD5-BCB1-1577CA8B4FB3" Value="5" Position="5" /> </Element> </Item> <Item FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="7885C54E-CF21-4D37-9317-E2634198D491" ID="4196R1" Position="1" StdError="0.704673530376081" Theta="0.760373280669304"> <Element ElementOID="8AB8BA58-3BB0-40B6-B656-C24F1169069B" Description="In the past 7 days" ElementOrder="1" /> <Element ElementOID="635B60F1-FDB0-48FA-A349-CE3967263630" Description="I was too tired to enjoy the things I like to do." ElementOrder="2" /> <Element ElementOID="C08BDEB7-358E-4CB6-BD43-54A234D2D75A" Description="ContainerForC08BDEB7-358E-4CB6-BD43-54A234D2D75A" ElementOrder="3"> <Map ElementOID="00483AA5-3F7A-47A7-85ED-B8158CAD3441" Description="Never" FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="0ADCCAA5-1A10-4FED-B2A6-E4FFF4FE3725" Value="1" Position="1" /> <Map ElementOID="463E034D-37AD-4B0B-836D-E8739DD54B48" Description="Almost Never" FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="EA09803E-00AA-4B53-885F-01869502983A" Value="2" Position="2" /> <Map ElementOID="025469C3-CDE6-480C-99B9-33DF319C369A" Description="Sometimes" FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="7885C54E-CF21-4D37-9317-E2634198D491" Value="3" Position="3" /> <Map ElementOID="2B092F99-1551-4871-8D42-6AD280AFEB33" Description="Often" FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="4CAA6EAC-446A-4B89-8EA8-073462FAF0C6" Value="4" Position="4" /> <Map ElementOID="DA3C4987-6335-448E-A95F-855BD4ED0276" Description="Almost Always" FormItemOID="FEE9A6CC-7492-466B-A2E0-443726B26F9D" ItemResponseOID="870C172B-ABA9-4896-BCDC-C89E79E22056" Value="5" Position="5" /> </Element> </Item> </Form>