Get Measure Using Form ID

Overview

This function should be used when:
  • There is no prior information about a student.
  • The student has taken an entire test form, represented by a form ID.
  • The raw score, or number of items answered correctly, is known.

URL

POST /api/score/form/id/standard

Request

The following parameters are required in the request. An example is provided in the Code Example section.

Parameter Type Description
formId

String

The ID of the form. Must have a prefix of "Q", "L", "S" or "A" to indicate form type. MetaMetrics will provide this ID.

numberCorrect

Integer

Raw count of items answered correctly by the student.

Parameter Type Description
formId

String

The ID of the form. Must have a prefix of “Q”, “L”, or “S” to indicate form type. MetaMetrics will provide this ID.

numberCorrect

Integer

Raw count of items answered correctly by the student.

Response

This returns an object that contains the computed ability and uncertainty. See Scoring Service Response Codes for an explanation of codes that might be returned.

Parameter Type Description
ability

Integer

The student's new ability estimate.

abilityDisplay

String

A display-ready version of the ability score with all business rules and formatting rules applied, including rounding to the nearest 5, top and bottom caps applied, conversion of negatives to BR or EM, and framework label appended (e.g. "320L" or "BR200L"). Use this value when presenting scores in user interfaces or reports.

uncertainty

Integer

Uncertainty associated with the student's new ability estimate.

framework String Either Lexile or Quantile framework used to produce the measure.
apiVersion String The current version number for the API.

Code Examples

The following show examples of the request followed by the response. The Python example is written for use with Python 3 and above.

import java.io.BufferedReader;
                import java.io.IOException;
                import java.io.InputStreamReader;
                import java.util.HashMap;
                import java.util.List;
                import java.util.ArrayList;
                import java.util.Arrays;
                import java.util.Map;
                import org.apache.http.HttpHeaders;
                import org.apache.http.HttpResponse;
                import org.apache.http.client.HttpClient;
                import org.apache.http.client.methods.HttpPost;
                import org.apache.http.entity.StringEntity;
                import org.apache.http.impl.client.HttpClientBuilder;
                
                import org.json.JSONObject;
                
                
                public class StandardFormId {
                public static void main( String[] args )
                {
                try
                {
                // Call 1
                
                String baseURL = "https://scoring.lexile.com";
                String clientId = "your_client_id";
                String clientSecret = "your_client_secret";
                
                HttpClient client = HttpClientBuilder.create().build();
                HttpPost authPost = new HttpPost(baseURL + "/authToken");
                JSONObject jsonInput = new JSONObject();
                jsonInput.put("clientId", clientId);
                jsonInput.put("clientSecret", clientSecret);
                StringEntity input = new StringEntity(jsonInput.toString());
                authPost.setEntity(input);
                authPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
                HttpResponse response = client.execute(authPost); 
                StringBuilder stringBuilder = new StringBuilder();
                BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
                String line;
                while ((line = rd.readLine()) != null) 
                {
                stringBuilder.append(line);
                }
                JSONObject json = new JSONObject(stringBuilder.toString());
                String token = (String) json.get("accessToken");
                Integer expires = (Integer) json.get("expiresIn");
                
                
                // 1) Basic Example
                
                HttpPost postForm = new HttpPost(baseURL + "/api/score/form/id/standard");
                JSONObject postData = new JSONObject();
                postData.put("formId", "Q138");
                postData.put("numberCorrect", 2);
                postData.put("framework", "quantile");
                
                StringEntity formInput = new StringEntity(postData.toString());
                postForm.setEntity(formInput);
                postForm.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token);
                postForm.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
                response = client.execute(postForm); 
                stringBuilder = new StringBuilder();
                rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
                while ((line = rd.readLine()) != null) 
                {
                stringBuilder.append(line);
                }
                JSONObject output = new JSONObject(stringBuilder.toString());
                Integer ability = (Integer) output.get("ability");
                Integer uncertainty = (Integer) output.get("uncertainty");
                String framework = (String) output.get("framework");
                String apiVersion = (String) output.get("apiVersion");
                }
                catch(IOException e) 
                {
                e.printStackTrace();
                }
                }
                }
                
                //System.out.println(stringBuilder.toString());
# Call 1
                    
                    # /authToken
                    
                    import requests
                    import json
                    
                    base_url = "https://scoring.lexile.com"
                    client_id = "your_client_id"  # replace with your provided client ID
                    client_secret = "your_client_secret"  # replace with your provided client secret
                    response = requests.post(
                    f"{base_url}/authToken",
                    data={"clientId": client_id, "clientSecret": client_secret},
                    )
                    access_token = response.json()["accessToken"]  # use in Authorization header
                    
                    # use these headers to make requests
                    headers = {
                    "Authorization": f"Bearer {access_token}",
                    "Content-Type": "application/json",
                    }
                    
                    
                    # /api/score/form/id/standard
                    
                    # 1) Basic Example
                    data = {"numberCorrect": 2, "formId": "Q138"}
                    response = requests.post(
                    f"{base_url}/api/score/form/id/standard", headers=headers, json=data
                    )
                    response.json()
                    # returns
                    # {
                    #    "ability": <int>,
                    #    "abilityDisplay": <string>,
                    #    "uncertainty": <int>
                    #    "framework": ["lexile", "quantile"]
                    #    "apiVersion": <string>
                    # }