Search test API

This document describes use of test search API /v1/test/search

General information

This API can be used to search for specific test(s) using REST APIs. There are several parameters that search can be performed on (see API description for more information)

Query search on this API is based on same search criteria as Inspera Assessment supports when using filter functions for test. This documentation will cover using search API to recover same information as filters provide in application.

Filters covered in this documentation are:


API description

Swagger documentation with datamodel can be found here: https://ia.inspera.no/apidoc/#/test/search

Search parameters

API can be called by either sending one or more available parameters:

  • externalTestID - which is ID test has in an external system and value has been passed on via API to Inspera Assessment when test was created

  • title - the name of the test

  • query - which corresponds to the filters mentioned under “General information”

Return information

If API call has beed successful, the API will return JSON file as result, holding following information:

  • hits” - number of tests found with the search

  • page” - number of file pages

  • results” array

    • assessmentRunId - Inspera internal TestID

    • assessmentRunTitle - test name / title

    • externalId - externalTestID (same value as in call above)

    • status - status test is in (active, created, finished, graded, grading in progress, scheduled)

    • startTime - test start time

    • endTime - test end time

    • isTemplate

    • metadataUrl - url to fetch test metadata

Example of return payload

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "hits": 44, "results": [ { "assessmentRunId": 28020726, "assessmentRunTitle": "All uploads varieties", "startTime": "2018-02-28T09:00:00Z", "endTime": "2018-03-31T10:00:00Z", "status": "FINISHED", "isTemplate": false, "metadataUrl": "https://ias.inspera.no/api/v1/test/28020726/" } ] }

Code examples

Search based on test externalTestID

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Search based on test title:

 

 

 

 


Search based on filter “Created by”

(search for test created by specific person)

NOTE:
”creationUserID” is Inspera user ID for administrative user. This can be fetched by either running “user” API or from application, under “User administration”

 


Search based on filter “Grading only”

 

 

 

 

 


Search based on filter “Created ”

This example is for searching for test created in period between two dates

 

 

 

 

 


Search based on filter “Status ”

Other statuses that can be searched on:

  • created

  • finished

  • graded

  • grading in progress (grading_in_progress)

  • scheduled


Search based on filter “Number of candidates ”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Complex queries

It is possible to combine queries above, for example search for tests with status “finished” and between two dates. The same logic of combining the queries that exists in the application is also applicable here.

See example of such query on the right side

API body:

1 2 3 { "externalTestId": "test_IA3-2434_2" }

Result: 200 success

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "hits": 1, "results": [ { "assessmentRunId": 58451623, "assessmentRunTitle": "IA3-2434", "externalId": "test_IA3-2434_2", "startTime": "2021-05-18T13:00:00Z", "endTime": "2021-05-18T14:30:00Z", "status": "FINISHED", "isTemplate": false, "metadataUrl": "https://ias.inspera.no/api/v1/test/58451623/" } ] }

 


 

API body:

1 2 3 { "title": "IA3-2434" }

 


API body

1 2 3 4 5 6 {"query": {"filters": {"creationUserId":"8511464" } } }

 


API Body:

1 2 3 4 5 {"query": {"filters": {"isCandidateSubmissionEnabled":false} } }

 


API Body:

1 2 3 4 5 6 7 8 9 10 {"query": {"filters": {"creationDate": { "lte": "2021-01-10T23:59:59", "gte": "2020-01-01T00:00:00" } } } }

API Body:

1 2 3 4 5 6 {"query": {"filters": {"status":"active" } } }

 


API body

“grater than” 20

1 2 3 4 5 6 {"query": {"filters": {"numberOfCandidates": {"gt":20} } } }

 

“smaller then” 20

1 2 3 4 5 6 {"query": {"filters": {"numberOfCandidates": {"lt":20} } } }

“between” 20 and 30

1 2 3 4 5 6 {"query": {"filters": {"numberOfCandidates": {"gte":20, "lte":30} } } }

API Body:

 

1 2 3 4 5 6 7 8 9 10 11 {"query": {"filters": {"status":"finished", "startTime": { "lte": "2021-01-10T23:59:59", "gte": "2020-01-01T00:00:00" } } } }