Skip to main content
System StatusContact Support
VersionOne Community

Learn By Example: History Queries

This section is a series of examples, starting with simpler queries and moving to more advanced queries. Any of these examples are viewable directly in a web browser capable of displaying XML data.

How to query an asset "as of" a specific time

Use the asof query parameter to retrieve data as it existed at some point in time. This URL finds the version of a Story asset as it existed at 5:30 PM on October 3rd, 2005:

 

http://localhost/VersionOne/rest-1.v1/Hist/Story/1364?asof=2005-08-03T17:30:00.00&sel=Name,ToDo,ChangeDate

 

<History total="1" pageSize="2147483647" pageStart="0">
	<Asset href="/VersionOne/rest-1.v1/Data/Story/1364/903" id="Story:1364:903">
		<Attribute name="Name">Company History</Attribute>
		<Attribute name="ChangeDate">2005-08-03T13:09:05.983</Attribute>
		<Attribute name="ToDo">0</Attribute>
	</Asset>
</History>

How to query the history of a single asset

This URL will retrieve the history of the Member asset with ID 20.

http://localhost/VersionOne/rest-1.v1/Hist/Member/20
<History total="2" pageSize="2147483647" pageStart="0">
	<Asset href="VersionOne/rest-1.v1/Data/Member/20/0" id="Member:20:0">
		<Attribute name="Description" /> 
		<Attribute name="Nickname">Admin</Attribute> 
		<Attribute name="Email" /> 
		<Attribute name="AssetState">64</Attribute> 
		<Attribute name="DefaultRole.Name">System Admin</Attribute> 
		<Attribute name="Username">admin</Attribute> 
		<Attribute name="IsLoginDisabled">false</Attribute> 
		<Relation name="DefaultRole">
			<Asset href="VersionOne/rest-1.v1/Data/Role/1" idref="Role:1" /> 
		</Relation>
		<Attribute name="Name">Administrator</Attribute> 
		<Attribute name="Phone" /> 
		<Attribute name="AssetType">Member</Attribute> 
	</Asset>
	<Asset href="VersionOne/rest-1.v1/Data/Member/20/113" id="Member:20:113">
		<Attribute name="Description" /> 
		<Attribute name="Nickname">Admin</Attribute> 
		<Attribute name="Email">admin@demo.com</Attribute> 
		<Attribute name="AssetState">64</Attribute> 
		<Attribute name="DefaultRole.Name">System Admin</Attribute> 
		<Attribute name="Username">admin</Attribute> 
		<Attribute name="IsLoginDisabled">false</Attribute> 
		<Relation name="DefaultRole">
			<Asset href="VersionOne/rest-1.v1/Data/Role/1" idref="Role:1" /> 
		</Relation>
		<Attribute name="Name">Administrator</Attribute> 
		<Attribute name="Phone">555-555-1212</Attribute>
		<Attribute name="AssetType">Member</Attribute> 
	</Asset>
</History>

How to query the history of a single attribute

This URL will retrieve the history of changes to the Email attribute of the Member asset with ID 20:

http://localhost/VersionOne/rest-1.v1/Hist/Member/20/Email
<History total="2" pageSize="2147483647" pageStart="0">
	<Attribute name="Email" href="/VersionOne/rest-1.v1/Data/Member/20/0/Email" of="/VersionOne/rest-1.v1/Data/Member/20/0" /> 
	<Attribute name="Email" href="/VersionOne/rest-1.v1/Data/Member/20/113/Email" of="/VersionOne/rest-1.v1/Data/Member/20/113">admin@demo.com</Attribute> 
</History>

How to query the history of many assets

Overview

This URL will retrieve history for all Story assets you are able to see:
 

http://localhost/VersionOne/rest-1.v1/Hist/Story?sel=Name,ToDo,ChangeDate

 

<History total="203" pageSize="2147483647" pageStart="0">
	<Asset href="/VersionOne/rest-1.v1/Data/Story/1364/818" id="Story:1364:818">
		<Attribute name="Name">Company History</Attribute> 
		<Attribute name="ToDo">40</Attribute>
		<Attribute name="ChangeDate">2005-08-01T12:28:35.577</Attribute> 
	</Asset>
	<Asset href="/VersionOne/rest-1.v1/Data/Story/1364/818" id="Story:1364:874">
		<Attribute name="Name">Company History</Attribute> 
		<Attribute name="ToDo">20</Attribute>
		<Attribute name="ChangeDate">2005-08-02T11:05:12.123</Attribute>
	</Asset>
	<Asset href="/VersionOne/rest-1.v1/Data/Story/1364/903" id="Story:1364:903">
		<Attribute name="Name">Company History</Attribute> 
		<Attribute name="ToDo">0</Attribute>
		<Attribute name="ChangeDate">2005-08-03T13:09:05.983</Attribute>					
	</Asset>
	<!-- Additional Asset Nodes -->
</History>

  • Was this article helpful?