Get history of test cases using REST API

Hi,
I’m trying to get history of test cases.
I’m using example as explained here:
https://www.testiny.io/docs/rest-api/retrieve-a-list-of-historic-values-for-the-specified-entity-id-ids/

I get following error:
{“type”:“ApiError”,“code”:“API_INVALID_REQUEST”,“message”:“Invalid entity”,“reqid”:“TJGRO5Og8bszSSzYq47y”}

Can u help with a detailed example, or checking in your logs,
what cause of error (see reqid)

Thanks.

3 Answers

3

Welcome to the Testiny forum,
To get the history of testcases, you need to specify “testcase” as the “:entity” placeholder

(POST) https://app.testiny.io/api/v1/history/entity/testcase

{
  "projectId": 1,
  "from": {"days": 7},
  "ids": [1234,12345]
}

This example queries the history of testcases “1234” and “12345” from project “1” over the last 7 days. The result then includes all historical values for the given ids, with the valid_from and valid_to properties describing the time interval for this value - with valid_to: null meaning “still current”

Michael
Testiny Team

Hi Michael,
Thanks it works.
What value should I put in "from": {"days": 7},
to get all the history. (I don’t want to check each item when it was created).
It works when I remove “from” completely,
but "from" : null - gave error, and setting value like int.max instead of 7, gave only one history item.
So the only way is to remove “from” completely ?
Thanks.

You can omit the “from”, but there is a limit of 1000 entries total returned (all versions of all entities)