Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

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

Table of Contents

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

Code Block
{
    "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:

Code Block
{
  "externalTestId": "test_IA3-2434_2"
}

Result: 200 success

Code Block
{
    "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:

Code Block
{
  "title": "IA3-2434"
}


API body

Code Block
{"query":
    {"filters":
        {"creationUserId":"8511464"
  }
  }
  }


API Body:

Code Block
{"query":
    {"filters":
        {"isCandidateSubmissionEnabled":false}
    }
}


API Body:

Code Block
   {"query":
    {"filters":
        {"creationDate":
          {
          "lte": "2021-01-10T23:59:59",
          "gte": "2020-01-01T00:00:00"
          }
        }
      }
  }

API Body:

Code Block
{"query":
    {"filters":
        {"status":"active"
        }
    }
}


API body

“grater than” 20

Code Block
{"query":
    {"filters":
        {"numberOfCandidates": {"gt":20}
        }
    }
}

“smaller then” 20

Code Block
{"query":
    {"filters":
        {"numberOfCandidates": {"lt":20}
        }
    }
}

“between” 20 and 30

Code Block
{"query":
    {"filters":
        {"numberOfCandidates": {"gte":20, "lte":30}
        }
    }
}

API Body:

Code Block
{"query":
  {"filters":
    {"status":"finished",
     "startTime": 
      {
       "lte": "2021-01-10T23:59:59",
        "gte": "2020-01-01T00:00:00"
      }
    }
   }
 }