Application Programming Interface
Score API Function Reference
We offer an easy-to use API which will allow you to easily integrate assessments from publishers into your platform. Using our API, you’ll be able to offer your client a full range of psychological test scoring.
Starting a session
In order to score a test, a session must be created first. Select one of the following response languages:
- html
- xml
- json
<?php
$url = "https://www.metrisquare.net/mps/Gate/xml/$company/$relationid/$testtype/$subtype/$clientid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$session_request_result_data = curl_exec($ch);
curl_close($ch);
?>
List of response properties
resultcode |
0=succes |
resultmessage | “ok” or error message |
sessionhash | unique session key |
Function setclient()
Use this function to set client properties, such as gender, educationlevel and date of birth.
List of client properties
C30 | Client.Number |
C31 | Client.Name |
C32 | Client.Initials |
C33 | Client.BirthDate |
C34 | Client.Gender |
C35 | Client.Testdate |
C36 | Client.ConsultDates |
C37 | Client.Age |
C38 | Client.AgeNum |
C39 | Client.EduCode |
C40 | Client.Education |
C41 | Client.Company |
C42 | Client.Division |
C43 | Client.Department |
C44 | Client.Region |
C45 | Client.Team |
C46 | Client.Psychologist |
C47 | Client.TestLeader |
C48 | Client.Remark1 |
C49 | Client.Remark2 |
C50 | Client.Remark3 |
C51 | Client.Occupation |
C52 | Client.ReportNumber |
C53 | Client.ForDivision |
C54 | Client.ForDepartment |
C55 | Client.ForRegion |
C56 | Client.ForTeam |
C57 | Client.ForPsychologist |
C58 | Client.Trial |
C59 | Client.Mhand |
C60 | Client.Free |
C61 | Client.Free3 |
C62 | Client.Free4 |
C63 | Client.TypeOutputBatchImport |
C64 | Version.Select |
C65 | Version.Program |
C66 | NrActiveTests |
<?php
$url_set_client = "https://www.metrisquare.net/mps/$sessionhash/setclient";
$url_set_client .= "?c30=$clientid";
$url_set_client .= "&c33=$birthdate";
$url_set_client .= "&c34=$gender";
$url_set_client .= "&c35=$testdate";
$url_set_client .= "&c37=$age";
$url_set_client .= "&c38=$age_year";
$url_set_client .= "&c39=$edulevel";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_set_client);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$set_client_result = curl_exec($ch);
curl_close($ch);
?>
Function getinputs()
Call this function to get a list of inputs of a test. Usually, these are numeric cells like answers to questionnaires, responses or reaction times. The inputs can be retrieved as xml, html or json.
Function getinputstate()
Returns one of the following values:
Empty | No inputs set yet |
Busy | One or more inputs set |
Done | All inputs set |
Overflow | Inputs set which should not have been set |
Example results of getinputs() for the test WISC-V as xml
<root>
<i30>
<Label>1</Label>
<Value></Value>
<Hint>1. Blokpatronen (BP)
-1= niet afgenomen
0..58= totaalscore</Hint>
<Min>-1</Min>
<Max>58</Max>
<Valid>False</Valid>
</i30>
<i31>
<Label>1a.</Label>
<Value></Value>
<Hint>1a. Blokpatronen zonder tijdbonus (BPz)
-1= niet gescoord
0..46= totaalscore</Hint>
<Min>-1</Min>
<Max>46</Max>
<Valid>False</Valid>
</i31>
...
<resultcode>0</resultcode>
<resultmessage>ok</resultmessage>
</root>
Function setinputs()
Use this function to set client properties, such as gender, educationlevel and date of birth.
<?php
$url_set_inputs = "https://www.metrisquare.net/mps/$sessionhash/setinputs";
$url_set_inputs .= "?i30=$BP";
$url_set_inputs .= "&i31=$BPz";
$url_set_inputs .= "&c32=$BPd";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_set_inputs);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$set_client_result = curl_exec($ch);
curl_close($ch);
?>
Function getoutputs()
Use this function to set client properties, such as gender, educationlevel and date of birth.
Example results of getoutputs() for the test WISC-V as xml
<root>
<o30>
<Label>SScOV</Label>
<Value>16</Value>
<Hint>Geschaalde score Overeenkomsten (Range: 0..19)</Hint>
<Min>0</Min>
<Max>19</Max>
</o30>
<o31>
<Label>SScWS</Label>
<Value>19</Value>
<Hint>Geschaalde score Woordenschat (Range: 0..19)</Hint>
<Min>0</Min>
<Max>19</Max>
</o31>
<o32>
<Label>SScBG</Label>
<Value>19</Value>
<Hint>Geschaalde score Begrijpen (Range: 0..19)</Hint>
<Min>0</Min>
<Max>19</Max>
</o32>
…
<resultcode>0</resultcode>
<resultmessage>ok</resultmessage>
</root>
Function createdetailreport()
Call this function to generate a detailed report, or part of the report. Use getdetailreport() to download the resulting PNG image.
Function getdetailreport()
After creating the report, it can be downloaded as PNG image using this function. Optionally, the following parameters can be passed to limit the range of the returned report image.
xrowstart | row number of the top-left cell |
xrowstop | row number of the bottom-right cell |
xcolstart | column number of the top-left left |
xcolstop | column number of the bottom-right cell |

API Playground
