|
RestApiSpecification
Specifies the REST API for SensorBase
1.0 IntroductionAll Hackystat 8.x services communicate with each other using an API based upon REST architectural principles. In a nutshell, this means that all Hackystat data can be referenced using URLs, and can be manipulated using the HTTP protocol methods such as PUT, GET, POST, HEAD, and DELETE. This document provides a specification of the "external" API to the SensorBase, in other words, it should provide everything you need to know in order to send data to this SensorBase and get data from it. If you are using Java to communicate with the SensorBase, then you will be interested in the SensorBaseClient class, which provides a convenient Java API that encapsulates the HTTP call/response process and performs bidirectional translation between XML and Java class representations. The REST architectural style begins with the concept of a "resource" which is an entity that can be "named" using an URI, and which has one (or more) "representations". Currently, the only representation supported is XML, although HTML representations for browser-based display of resources is a future possible enhancement. The following table summarizes the REST API for this service. Note that this table does not specify any payload that must be associated with a request, nor does it include parameters that might be required for authorization or other purposes. For readability, the resource type associated with the operation is boldfaced, and a space is inserted before each URL parameter in order to facilitate line breaks.
The remainder of this document is organized as follows. Section 2.0 presents the specification of the resources that are managed using this SensorBase: Sensor Data, Sensor Data Type, User, Project, Ping, and Database (db). It provides a high-level overview of the structure and purpose of these resources without going into detail on how these resources are manipulated using HTTP calls. Section 3.0 presents the implementation of these resources, including the specifics of the HTTP methods, their parameters, return values, authorization, caching, and so forth. 2.0 Resource DesignThis SensorBase supports the following resource types: Sensor Data, Sensor Data Type, Project, and User. 2.1 Resource Design: Sensor DataEach Sensor Data resource instance represents an "atomic" unit of software engineering process or product data. 2.1.1 Sensor Data URI SpecificationSensor Data resources are named using the following URI specification:
Where:
So, an example Sensor Data URI is:
Some implications of this URI specification are:
2.1.2 Sensor Data ContentsEach Sensor Data resource contains the following fields:
Note that some of the key-value pairs in the Properties field will be "required" by the SDT associated with this sensor data. 2.2 Resource Design: Sensor Data Type (SDT)The Sensor Data Type (SDT) resource specifies the structure of domain-specific sensor data. SDTs are used to support consistent, generic analyses on sensor data regardless of what tool generated the data. For example, an SDT called "UnitTest" might require any tool that sends data of that type to provide a property called "Result" whose value is either "Passed" or "Failed". This enables a generic analysis over UnitTest data that computes the number of tests invoked in a day and the percentage that passed, and which can generate that analysis regardless of the tool that generated the data, or even when multiple different tools generate sensor data of that type. Hackystat Version 7 provides examples of 15 sensor data types and their required and optional fields, as documented in Chapter 25. Sensor Data Types. Currently, the SensorBase will not reject sensor data that does not conform to its declared Sensor Data Type. In a future version, we will enhance sensor data retrieval mechanisms with a "compliant" option that will do this checking. 2.2.1 SDT URI SpecificationSDT resources can be named using the following URI specification:
Where:
So, an example SDT URI is:
2.2.2 SDT ContentsAn SDT resource provides the following fields:
Some implications of this representation are:
2.3 Resource Design: ProjectA Project resource names a subset of sensor data corresponding to a group of Users, a time interval, and a "URI Pattern". 2.3.1 Project URI SpecificationProject resources can be named using the following URI specification:
Where:
So, an example Project URI is:
Some implications of this representation are:
2.3.2 Project ContentsA Project resource contains the following fields:
Note that the Sensor Data specified by a Project definition is the logical "AND" of the time interval, Owner plus Members, and UriPatterns. 2.3.3 The Default ProjectEvery user has an implicitly defined Project called "Default" that is defined to encompass all of their personal data ever collected. This Project is named "Default" and is defined at the time of User registration. The Default project representation is generated by the system and cannot be edited by users. 2.3.4 Invitations and the Membership processThe owner of a Project can "invite" other Hackystat users to become "Members" of this project. When a user is a Project Member, that means that their data can be combined with the Owner and other Member data to support aggregate analyses. When a user is on the Invitations list, that means that they can retrieve and view the Project definition, but their sensor data will yet not be included in analyses. For this to happen, they must "accept" the invitation, which removes them from the Invitations list and adds them to the Members list. The "accept" URI specification is:
Users on the Members or Invitations lists can remove themselves at any time by "declining". The "decline" URI specification is:
Note that the user accepting or declining is not, by definition, the {owner} in the URL. 2.4 Resource Design: UserA User specifies an "actor" in the software development environment. Usually, each User corresponds to a developer, though there may be non-human Users, such as automated Build processes, that could have their own accounts and generate data that is sent as part of a Project. 2.4.1 User URI SpecificationUser resources can be named using the following URI specification:
Where:
So, an example User URI is:
2.4.2 User ContentsThe User resource contains the following fields:
Note that all Properties are optional. 2.5 Resource Design: PingThe Ping resource simply represents the availability of this service. 2.6 Resource Design: Database (db)The Database resource provides limited ability to interact with the underlying relational database associated with this repository. 3.0 Resource ImplementationThe previous section provided overviews of the resources supported by this SensorBase. This section shows how to create, retrieve, modify, and delete those resources. It also includes details on the XML representation of the resources, and the possible HTTP status codes that could be returned from a request. 3.0.1 Access Control LevelsThe SensorBase uses HTTP Basic authentication to support access control. The SensorBase supports the following types of access control: None, AnyUser, TheUser, ProjectOwner, ProjectOwnerOrMember, ProjectOwnerOrMemberOrInviteeOrSpectator, and Admin.
3.0.2 Default Implementation ConstraintsHackystat provides an embedded Derby database implementation for storage and retrieval of this information. This implemention currently imposes the following constraints on the sizes of certain fields:
The following sections present the detailed description of the above operations. 3.1 Resource Implementation: Sensor Data Type3.1.1 GET {host}/sensordatatypesReturns an index of all sensor data type resource names. For example, given
An example return value is: <?xml version="1.0"?> <SensorDataTypeIndex> <SensorDataTypeRef Name="UnitTest" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordatatypes/UnitTest"/> <SensorDataTypeRef Name="DevEvent" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordatatypes/DevEvent"/> </SensorDataTypeIndex> Possible status codes:
Access Control Level: AnyUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordatatypes.xsd 3.1.2 GET {host}/sensordatatypes/{sensordatatypename}Returns a representation of the named sensor data type resource. For example, given:
An example return value is: <?xml version="1.0"?>
<SensorDataType Name="UnitTest">
<Description>Represents a single unit test invocation.</Description>
<RequiredFields>
<RequiredField>
<Name>Result</Name>
<Description>Should be "Passed" or "Failed"</Description>
</RequiredField>
</RequiredFields>
<Properties>
<Property>
<Key>Version</Key>
<Value>2.1</Value>
</Property>
</Properties>
</SensorDataType>Possible status codes:
Access Control Level: AnyUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordatatypes.xsd 3.1.3 PUT {host}/sensordatatypesCreates or updates a sensor data type. For example,
With payload: <?xml version="1.0"?>
<SensorDataType Name="UnitTest">
<Description>Represents a single unit test invocation.</Description>
<RequiredFields>
<RequiredField>
<Name>Result</Name>
<Description>Should be "Passed" or "Failed"</Description>
</RequiredField>
</RequiredFields>
<Properties>
<Property>
<Key>Version</Key>
<Value>2.1</Value>
</Property>
</Properties>
</SensorDataType>Will define a new Sensor Data Type called UnitTest. If the UnitTest SDT already exists, it is updated to this definition. Possible status codes:
Access Control Level: Admin XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordatatypes.xsd 3.1.4 DELETE {host}/sensordatatypes/{sensordatatypename}Ensures that the specified sensor data type named by this URI is no longer defined in the SensorBase. For example,
Will delete the UnitTest SDT instance. Note: this does not affect any sensor data stored in the SensorBase with that SDT name. Possible status codes:
Access Control Level: Admin XmlSchema: N/A 3.1.5 Default Sensor Data Type definitionFor convenience, it is possible to bundle a set of sensor data type definitions with a SensorBase service in the file xml/defaults directory. The file, sensordatatypes.defaults.xml, must contain a set of valid SDT definitions. The following example contains two SDT definitions: <?xml version="1.0"?>
<SensorDataTypes>
<SensorDataType Name="UnitTest">
<Description>Represents a single unit test invocation.</Description>
<RequiredFields>
<RequiredField>
<Name>Result</Name>
<Description>Should be "Passed" or "Failed"</Description>
</RequiredField>
</RequiredFields>
<Properties>
<Property>
<Key>Version</Key>
<Value>2.1</Value>
</Property>
</Properties>
</SensorDataType>
<SensorDataType Name="Commit">
<Description>Represents a single CM commit.</Description>
<RequiredFields>
<RequiredField>
<Name>Version</Name>
<Description>The version ID assigned to this commit"</Description>
</RequiredField>
</RequiredFields>
</SensorDataType>
</SensorDataTypes>XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordatatypes.xsd 3.2 Resource Implementation: Project3.2.1 GET {host}/projectsReturns an index of all project resource names in this SensorBase. For example:
Might return: <?xml version="1.0"?> <ProjectIndex> <ProjectRef Name="SensorBase-8.0" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/SensorBase-8.0"/> <ProjectRef Name="BarbieDoll" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/BarbieDoll"/> <ProjectRef Name="Default" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/Default"/> <ProjectRef Name="Assignment1" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/hongbing@hawaii.edu/Assignment1"/> <ProjectRef Name="Default" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/hongbing@hawaii.edu/Default"/> </ProjectIndex> Possible status codes:
Access Control Level: Admin XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/projects.xsd 3.2.2 GET {host}/projects/{user}Returns an index of all project resource names associated with {user}. For example,
Might return: <?xml version="1.0"?> <ProjectIndex> <ProjectRef Name="SensorBase-8.0" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/hongbing@hawaii.edu/SensorBase-8.0"/> <ProjectRef Name="BarbieDoll" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/hongbing@hawaii.edu/BarbieDoll"/> <ProjectRef Name="Default" href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/hongbing@hawaii.edu/Default"/> </ProjectIndex> Note that {user} might be associated with a Project as an Owner, Member, Invitee, or Spectator. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/projects.xsd 3.2.3 GET {host}/projects/{owner}/{projectname}Returns a representation of the named Project resource. For example:
Might return: <?xml version="1.0"?>
<Project Name="Jupiter-3.3">
<Description>Release 3.3 of the Jupiter code review plugin for Eclipse</Description>
<StartTime>2006-01-31T00:00:00.000</StartTime>
<EndTime>2007-01-20T00:00:00.000</EndTime>
<Owner>http://dasha.ics.hawaii.edu:9876/sensorbase/users/hongbing@hawaii.edu</Owner>
<Members>
<Member>http://dasha.ics.hawaii.edu:9876/sensorbase/users/johnson@hawaii.edu</Member>
</Members>
<Invitations>
<Invitation>http://dasha.ics.hawaii.edu:9876/sensorbase/users/senin@hawaii.edu</Invitation>
</Invitations>
<Spectators></Spectators>
<UriPatterns>
<UriPattern>file://**/Jupiter/**</UriPattern>
</UriPatterns>
<Properties>
<Property>
<Key>TDD-Group</Key>
<Value>True</Value>
</Property>
</Properties>
</Project>The Owner, Members, Invitees, and Spectators can all retreive the Project representation. Possible status codes:
Access Control Level: ProjectOwnerOrMemberOrInviteeOrSpectator XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/projects.xsd 3.2.4 GET {host}/projects/{owner}/{projectname}/sensordataReturns an index of all SensorData resource names in this Project. For example:
Might return: <?xml version="1.0"?> <SensorDataIndex> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.000"/> <SensorDataRef Owner="johnson@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.010"/> <SensorDataRef Owner="johnson@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.200"/> </SensorDataIndex> Although the User, SDT, and timestamp could be extracted from parsing the URI, they are communicated in their own fields to make it simple and efficient for clients to extract from the index of all Sensor Data just the entries they are interested in actually retrieving from the SensorBase. Depending upon the Project, this GET might return a very large number of Sensor Data references. The next command illustrates a way to retrieve a potentially more maneagable number of Sensor Data references, by restricting the index to a single 24 hour period. Possible status codes:
Access Control Level: ProjectOwnerOrMemberOrSpectator XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.2.5 GET {host}/projects/{owner}/{projectname}/sensordata (params)Returns an index of all SensorData resource names in this Project that satisfy the passed parameters. There are several formats for parameters: ?startTime={tstamp}&endTime={tstamp}and ?sdt=<sensordatatype>&startTime={tstamp}&endTime={tstamp}and ?sdt=<sensordatatype>&startTime={tstamp}&endTime={tstamp}&tool={tool}and ?startTime={tstamp}&endTime={tstamp}&startIndex={startindex}&maxInstances={maxinstances}For example:
Might return: <?xml version="1.0"?> <SensorDataIndex> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.000"/> <SensorDataRef Owner="johnson@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.010" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.010"/> <SensorDataRef Owner="johnson@hawaii.edu" Tool="Eclipse" SensorDataType="DevEvent" Timestamp="2007-04-30T09:00:00.200" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/DevEvent/2007-04-30T09:00:00.200"/> </SensorDataIndex> If the URL was instead:
Then a SensorDataIndex containing only sensor data with SDT named "Commit" would be returned. If the startIndex and maxInstances parameters are supplied along with the start and end time, then it is possible to obtain a SensorDataIndex containing only a subset of the sensor data for the specified time interval. This enables a user interface to "scroll through" a large data set for a given interval. For example, a day might contain 50,000 instances, and these parameters would allow retrieval of 1,000 entries at a time. By specifying "Default" as the Project, it is possible to use this URI to obtain all sensor data for this user for the given time interval specified by the timestamp and duration. Possible status codes:
Access Control Level: ProjectOwnerOrMemberOrSpectator XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.2.6 GET {host}/projects/{owner}/{projectname}/summary (params)Returns a ProjectSummary representation of the Project for the given time period, given a startTime and endTime param. For example:
Might return: <?xml version="1.0"?>
<ProjectSummary Href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/Default">
<StartTime>2007-04-30T09:00:00.000</StartTime>
<EndTime>=2007-04-30T09:30:00.000</EndTime>
<SensorDataSummaries NumInstances="5247">
<SensorDataSummary SensorDataType="Commit" Tool="SVN" NumInstances="2001"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Eclipse" NumInstances="3214"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Emacs" NumInstances="10"/>
<SensorDataSummary SensorDataType="" Tool="SensorShell" NumInstances="22"/>
</SensorDataSummaries>
</ProjectSummary> By specifying "Default" as the Project, it is possible to use this URI to obtain a summary for all sensor data owned by this user for the given time interval specified by the timestamp and duration. Instead of specifying startTime and endTime, you can specify startTime and numDays. This returns a MultiDayProjectSummary instance with embedded ProjectSummary instances for each of the days. For example:
Might return: <?xml version="1.0"?>
<MultiDayProjectSummary>
<ProjectSummary Href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/Default">
<StartTime>2007-04-30T09:00:00.000</StartTime>
<EndTime>2007-05-01T09:00:00.000</EndTime>
<SensorDataSummaries NumInstances="5247">
<SensorDataSummary SensorDataType="Commit" Tool="SVN" NumInstances="2001"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Eclipse" NumInstances="3214"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Emacs" NumInstances="10"/>
<SensorDataSummary SensorDataType="" Tool="SensorShell" NumInstances="22"/>
</SensorDataSummaries>
</ProjectSummary>
<ProjectSummary Href="http://dasha.ics.hawaii.edu:9876/sensorbase/projects/johnson@hawaii.edu/Default">
<StartTime>2007-05-01T09:00:00.000</StartTime>
<EndTime>=2007-05-02T09:00:00.000</EndTime>
<SensorDataSummaries NumInstances="2345">
<SensorDataSummary SensorDataType="Commit" Tool="SVN" NumInstances="1345"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Eclipse" NumInstances="567"/>
<SensorDataSummary SensorDataType="DevEvent" Tool="Emacs" NumInstances="12"/>
<SensorDataSummary SensorDataType="" Tool="SensorShell" NumInstances="13"/>
</SensorDataSummaries>
</ProjectSummary>
</MultiDayProjectSummary>
Possible status codes:
Access Control Level: ProjectOwnerOrMemberOrSpectator XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.2.6 PUT {host}/projects/{owner}/{projectname}Creates a representation of the named Project resource. For example:
With the following Payload: <?xml version="1.0"?>
<Project Name="Jupiter-3.3">
<Description>Release 3.3 of the Jupiter code review plugin for Eclipse</Description>
<StartTime>2006-01-31T00:00:00.000</StartTime>
<EndTime>2007-01-20T00:00:00.000</EndTime>
<Owner>hongbing@hawaii.edu</Owner>
<Members>
<Member>johnson@hawaii.edu</Member>
</Members>
<Invitations>
<Invitation>nickles@hawaii.edu</Invitation>
</Invitations>
<Spectator></Spectator>
<UriPatterns>
<UriPattern>file://**/Jupiter/**</UriPattern>
</UriPatterns>
<Properties>
<Property>
<Key>TDD-Group</Key>
<Value>True</Value>
</Property>
</Properties>
</Project>Will create a new Project for this User. If a Project with this name already exists, it will be updated with this information. Note that the email addresses for the Owner and all Members and Invitees must refer to existing Users. When creating a Project for the first time, the Members list must be empty. Thereafter, the Members list cannot include users who are not already on the Members list. In other words, a Project owner can only remove Members from a Project, they cannot add them. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/projects.xsd 3.2.7 DELETE {host}/projects/{user}/{projectname}Deletes the named Project resource. For example,
Will delete the Project instance. Note that this does not delete any of the Sensor Data that was associated with this Project. Possible status codes:
Access Control Level: TheUser XmlSchema: N/A 3.2.8 POST {host}/projects/{owner}/{projectname}/invitation/acceptAccepts the project invitation, which moves the authenticated user from the Invitations list to the Members list. For example, if johnson@hawaii.edu was on the Invitations list for the Project Jupiter-3.3 owned by hongbing@hawaii.edu, and if johnson@hawaii.edu issued the following request:
Then johnson@hawaii.edu would be removed from the Invitations list and added to the Members list for this Project. Possible status codes:
Access Control Level: ProjectInvitee XmlSchema: N/A 3.2.9 POST {host}/projects/{owner}/{projectname}/invitation/declineDeclines the project invitation or membership in the project. For example, if johnson@hawaii.edu was on the Invitations list for the Project Jupiter-3.3 owned by hongbing@hawaii.edu, and if johnson@hawaii.edu issued the following request:
Then johnson@hawaii.edu would be removed from the Invitations list. Members can also remove themselves from a Project by issuing this decline URL. Possible status codes:
Access Control Level: ProjectInviteeOrMember XmlSchema: N/A 3.2.10 POST {host}/projects/{owner}/{projectname}/rename/{newprojectname}Renames {projectname} to {newprojectname}. For example:
This renames the project called "Jupiter-3.3" to "Jupiter-3.3.0". All other aspects of the project remain the same. Possible status codes:
Access Control Level: ProjectOwner XmlSchema: N/A 3.3 Resource Implementation: User3.3.1 GET {host}/usersReturns an index of all User resource names. For example,
Might return: <?xml version="1.0"?> <UserIndex> <UserRef Email="johnson@hawaii.edu" href="http://dasha.ics.hawaii.edu:9876/sensorbase/users/johnson@hawaii.edu"/> <UserRef Email="hongbing@hawaii.edu" href="http://dasha.ics.hawaii.edu:9876/sensorbase/users/hongbing@hawaii.edu"/> </UserIndex> Possible status codes:
Access Control Level: Admin XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/users.xsd 3.3.2 GET {host}/users/{user}Returns a representation of the named User resource. For example,
Might return: <?xml version="1.0"?>
<User>
<Email>kagawaa@hawaii.edu</Email>
<Password>changeMe</Password>
<Role>Basic</Role>
<Properties>
<Property>
<Key>TDD-Group</Key>
<Value>True</Value>
</Property>
</Properties>
</User>Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/users.xsd 3.3.3 HEAD {host}/users/{user}Provides a lightweight means for a higher-level service to determine if a given user is authenticated in this SensorBase.
Will return a status code indicating whether the HTTP Basic credentials supplied with this request are correct for senin@hawaii.edu. Possible status codes:
Access Control Level: TheUser XmlSchema: N/A 3.3.4 POST {host}/registerCreate (or retrieve an existing) User resource, emailing a password to the User's email address. For example,
Will check to see if 'johnson@hawaii.edu' is already registered with this SensorBase. If so, the password currently associated with that user will be sent to that email address. If not, a new password will be generated and sent to that email address. Possible status codes:
Access Control Level: None XmlSchema: N/A 3.3.5 GET {host}/registerRetrieve an HTML page allowing manual registration of a User by filling out a form. For example,
Will return a simple HTML web page allowing the User to type in an email address to be registered. Possible status codes:
Access Control Level: None XmlSchema: N/A 3.3.6 POST {host}/users/{user}Update the properties associated with an existing User. For example,
With payload: <?xml version="1.0"?>
<Properties>
<Property>
<Key>TDD-Group</Key>
<Value>True</Value>
</Property>
</Properties>Note that the only User Xml element that can be successfully modified by POST is the Properties element. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/users.xsd 3.3.7 DELETE {host}/users/{user}Deletes the specified user. For example,
Will delete the User "senin@hawaii.edu". Deleting a user does not affect any Sensor Data or Project memberships associated with this User; references to this User in Sensor Data and Project resources become "dangling". Possible status codes:
Access Control Level: TheUser XmlSchema: N/A 3.4 Resource Implementation: Sensor Data3.4.1 GET {host}/sensordataReturns an index of all Sensor Data resources in this server. For example,
Might return: <?xml version="1.0"?> <SensorDataIndex> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.000"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.010" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.010"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.200" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.200"/> </SensorDataIndex> Note that this request could return a very, very large XML file. Possible status codes:
Access Control Level: Admin XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.4.2 GET {host}/sensordata/{user}Returns an index of all Sensor Data resources associated with this User. For example,
Might return: <?xml version="1.0"?> <SensorDataIndex> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.000"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.010" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.010"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.200" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.200"/> </SensorDataIndex> Note that this request could return a very large XML file. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.4.3 GET {host}/sensordata/{user} (with sdt parameter)Returns an index of all Sensor Data resource names of the given SDT associated with this User. For example,
Might return: <?xml version="1.0"?> <SensorDataIndex> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.000" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.000"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.010" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.010"/> <SensorDataRef Owner="hongbing@hawaii.edu" Tool="Subversion" SensorDataType="Commit" Timestamp="2007-04-30T09:00:00.200" href="http://dasha.ics.hawaii.edu:9876/sensorbase/sensordata/hongbing@hawaii.edu/Commit/2007-04-30T09:00:00.200"/> </SensorDataIndex> Note that this request could return a large XML file. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.4.4 GET {host}/sensordata/{user}/{timestamp}Returns a representation of the Sensor Data resource named by this URI. For example,
Might return: <?xml version="1.0"?>
<SensorData>
<Timestamp>2007-04-30T09:00:00.000</Timestamp>
<Runtime>2007-04-30T09:00:00.000</Runtime>
<Tool>Subversion</Tool>
<SensorDataType>http://dasha.ics.hawaii.edu:9876/sensorbase/sensordatatype/Commit</SensorDataType>
<Resource>file://home/johnson/svn/Foo/build.xml</Resource>
<Owner>http://dasha.ics.hawaii.edu:9876/sensorbase/user/hongbing@hawaii.edu</Owner>
<Properties>
<Property>
<Key>TotalLines</Key>
<Value>137</Value>
</Property>
<Property>
<Key>LinesAdded</Key>
<Value>10</Value>
</Property>
<Property>
<Key>LinesDeleted</Key>
<Value>12</Value>
</Property>
<Property>
<Key>Repository</Key>
<Value>svn://www.hackystat.org/</Value>
</Property>
<Property>
<Key>RevisionNumber</Key>
<Value>2345</Value>
</Property>
<Property>
<Key>Author</Key>
<Value>johnson</Value>
</Property>
</Properties>
</SensorData>Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.4.5 PUT {host}/sensordata/{user}/{timestamp}Create a representation of the named Sensor Data resource. For example,
With payload: <?xml version="1.0"?>
<SensorData>
<Timestamp>2007-04-30T09:00:00.000</Timestamp>
<Runtime>2007-04-30T09:00:00.000</Runtime>
<Tool>Subversion</Tool>
<SensorDataType>Commit</SensorDataType>
<Resource>file://home/johnson/svn/Foo/build.xml</Resource>
<Owner>hongbing@hawaii.edu</Owner>
<Properties>
<Property>
<Key>TotalLines</Key>
<Value>137</Value>
</Property>
<Property>
<Key>LinesAdded</Key>
<Value>10</Value>
</Property>
<Property>
<Key>LinesDeleted</Key>
<Value>12</Value>
</Property>
<Property>
<Key>Repository</Key>
<Value>svn://www.hackystat.org/</Value>
</Property>
<Property>
<Key>RevisionNumber</Key>
<Value>2345</Value>
</Property>
<Property>
<Key>Author</Key>
<Value>johnson</Value>
</Property>
</Properties>
</SensorData>Will create a new Sensor Data instance that can be named via that Timestamp. If a sensor data instance with that timestamp already exists, it is overwritten. Note that the timestamp specified in the URI must match the timestamp specified in the XML payload. Possible status codes:
Access Control Level: TheUser XmlSchema: http://hackystat-sensorbase-uh.googlecode.com/svn/trunk/xml/schema/sensordata.xsd 3.4.6 DELETE {host}/sensordata/{user}/{timestamp}Deletes the representation of the Sensor Data resource named by this URI. For example,
Will delete the resource named by that URI. Possible status codes:
Access Control Level: TheUser XmlSchema: N/A 3.5 Resource Implementation: Ping3.5.1 GET {host}/pingReturn the string "SensorBase". The "ping" resource is a low cost way of testing whether a host URI is responding to requests, and what kind of Hackystat service it is. No authentication is required. If user and password parameters are supplied, then will return "SensorBase authenticated" if the user and password are valid. Possible status codes:
Access Control Level: None XmlSchema: N/A 3.6 Resource Implementation: Database (db)3.6.1 PUT {host}/db/table/compressCompresses the tables associated with the underlying database. For example,
will invoke the "compress" command on all tables in the underlying database, which has the potential to reduce the amount of disk space consumed by the repository if large amounts of data have been deleted. Access Control Level: Admin 3.6.2 PUT {host}/db/table/indexEnsures that the latest set of indexes associated with the current release of the system are created in the underlying repository.
will invoke a set of index commands on the underlying repository. Access Control Level: Admin 3.6.3 GET {host}/db/table/{table}/rowcountReturns an integer indicating the number of rows in the specified table. This can be useful for monitoring the size and growth of your repository over time.
will return the current number of rows in the SensorData table, which is also the total number of SensorData instances in the repository. Access Control Level: Admin Possible status codes:
|
Sign in to add a comment