Applications - Consensus
  • 18 Oct 2024
  • 1 Minute to read
  • Dark
    Light

Applications - Consensus

  • Dark
    Light

Article summary

Consensus History

The Application Consensus History returns subject-media consensus counts over time for the output subjects of the application.

Consensus History

Currently the Application consensus history is limited to 1 year. Through the SDK users will also get only at most a years worth of data.

Argument

Example

Description

start unix timestamp

1234567890

(optional)  Earliest timestamp of subject-media consensus records to return. If the start timestamp is not specified, it defaults to a year before the end timestamp.

end unix timestamp

1234567890

(optional)  The latest timestamp of subject-media consensus records to return. If the end timestamp is not specified, it defaults to the current time.

limit integer

10

(optional)  Max number of records (per subject) to return.

user_id string

user@cogniac.co

(optional)  Returns consensus counts for subject-media correctly asserted by the given user.

GET /1/applications/{app_id}/consensusHistory
Host: https://api.cogniac.io

Example: Retrieve Application Subject Consensus History

#!/bin/bash
curl -X GET https://api.cogniac.io/1/applications/ra7vf9zl/consensusHistory?limit=2 \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
| json_pp
import requests
import json
my_headers = {"Authorization":"Bearer abcdefg.hijklmnop.qrstuvwxyz"}

resp = requests.get("https://api.cogniac.io/1/applications/ra7vf9zl/consensusHistory?limit=2",
                     headers=my_headers)

if resp.status_code == 200:
    formatted_json = json.dumps(resp.json(), indent=2)
    print(formatted_json)
else:
    print(f"Error: {resp.status_code}")
    print(resp.content)
{
  "data": [
    {
      "timestamp": 1683314460.0,
      "subjects": {
        "datelhcopy_3te": {
          "All": 62
        },
        "steellhcopy_0pl": {
          "All": 70
        },
        "wheel_stylelhcopy_9zb": {
          "All": 58
        },
        "plantlhcopy_0ys": {
          "All": 70
        }
      }
    },
    {
      "timestamp": 1683314520.0,
      "subjects": {
        "serial_nunberlhcopy_3xa": {
          "All": 89
        },
        "steellhcopy_0pl": {
          "All": 70
        },
        "datelhcopy_3te": {
          "All": 62
        },
        "plantlhcopy_0ys": {
          "All": 70
        },
        "wheel_stylelhcopy_9zb": {
          "All": 58
        }
      }
    }
  ]
}


Was this article helpful?