Application & Process Automation
- Getting Started
- Common Usage Scenarios
- Troubleshooting
- Using Custom IDs
- API Method Reference
-
- GetPrograms
- GetForms
- GetFormSchema
- GetProjects
- GetProjectsByNumber
- GetProjectsByData
- CreateNewProject
- GetAllProjectData - Admin only
- GetProjectData
- SetProjectData
- GetActiveAttachment
- GetAttachmentAsAdmin – Admin only
- SetProjectAttachment
- SetAttachmentMetadata
- GetAttachmentMetadata
- SubmitProject
- GetStatusList – Admin only
- GetCustomListChoices
- GetProjectStatusHistory – Admin only
- SetProjectStatus – Admin only
- GetExportProject – Admin only
- CreateMfaSessionToken
- DeleteMfaSessionToken
- SetAssignee
- SetProjectOwner
- GetInquiryThreads – Admin Only
- GetNotesInInquiryThread – Admin Only
- SetInquiryNote – Admin Only
- SetInquiryThreadStatus – Admin Only
- SetInquiryThreadExternalId – Admin Only
- SetProjectStatusReportAs – Admin only
- Code Samples
GetProjectStatusHistory – Admin only
Requires membership in an administrator role and read access to the program and project.
HTTP verb: GET
Required inputs: ProgramId, ProjectId
<ProjectStatusHistoryResponse>
<Project ProjectId="JC8SR659PV" ProgramId="1HF29X4P" ProjectNumber="TEST-00011">
<StatusHistory>
<Status StatusId="U2KE36T4" Name="Permission to Operate" ChangedBy="solar@cleanpower.com" Timestamp="2015-04-14T09:43:24-07:00"/>
<Status StatusId="U11N9F91" Name="Application Review" ChangedBy="solar@cleanpower.com" Timestamp="2015-04-14T09:41:17-07:00"/>
<Status StatusId="759NA6NH" Name="Inspection Pending" ChangedBy="solar@cleanpower.com" Timestamp="2015-04-14T09:39:40-07:00"/>
<Status StatusId="U11N9F91" Name="Application Review" ChangedBy="solar@cleanpower.com" Timestamp="2015-04-08T11:10:29-07:00"/>
<Status StatusId="3X8KK600" Name="Unsubmitted" ChangedBy="solar@cleanpower.com" Timestamp="2015-04-08T11:03:07-07:00"/>
</StatusHistory>
</Project>
</ProjectStatusHistoryResponse>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://services.powerclerk.com/api/v1/">
<xs:element name="ProjectStatusHistoryResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="StatusHistory">
<xs:complexType>
<xs:sequence>
<xs:element name="Status" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="StatusId" use="required"/>
<xs:attribute type="xs:string" name="CustomId" use="optional"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="ChangedBy" use="required"/>
<xs:attribute type="xs:dateTime" name="Timestamp" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="ProjectId" use="required"/>
<xs:attribute type="xs:string" name="ProgramId" use="required"/>
<xs:attribute type="xs:string" name="ProjectNumber" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:float" name="SchemaVersion"/>
</xs:complexType>
</xs:element>
</xs:schema>
Response XML Attributes
<Project> Attributes
ProjectId
– Unique identifier for the project
ProgramId
– Unique identifier for the program
ProjectNumber
– The project number. Projects are assigned a project number when they have been submitted.
<Status> Attributes
StatusId
– Unique identifier for the status
CustomId
– Custom, admin-provided, unique identifier for the status
Name
– Status name
ChangedBy
– Name of the user who initiated the status change
Timestamp
– Timestamp of when the project entered the given status. Converted to user’s local timezone.
<ProjectStatusHistoryResponse>
<Project ProjectId="JC8SR659PV" ProgramId="1HF29X4P" ProjectNumber="TEST-00011">
<StatusHistory>
<Status StatusId="U2KE36T4" Name="Permission to Operate" Timestamp="2015-04-14T09:43:24-07:00"/>
<Status StatusId="U11N9F91" Name="Application Review" Timestamp="2015-04-14T09:41:17-07:00"/>
<Status StatusId="759NA6NH" Name="Inspection Pending" Timestamp="2015-04-14T09:39:40-07:00"/>
<Status StatusId="U11N9F91" Name="Application Review" Timestamp="2015-04-08T11:10:29-07:00"/>
<Status StatusId="3X8KK600" Name="Unsubmitted" Timestamp="2015-04-08T11:03:07-07:00"/>
</StatusHistory>
</Project>
</ProjectStatusHistoryResponse>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://services.powerclerk.com/api/v1/">
<xs:element name="ProjectStatusHistoryResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="StatusHistory">
<xs:complexType>
<xs:sequence>
<xs:element name="Status" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="StatusId" use="required"/>
<xs:attribute type="xs:string" name="CustomId" use="optional"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:dateTime" name="Timestamp" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="ProjectId" use="required"/>
<xs:attribute type="xs:string" name="ProgramId" use="required"/>
<xs:attribute type="xs:string" name="ProjectNumber" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:float" name="SchemaVersion"/>
</xs:complexType>
</xs:element>
</xs:schema>
Response XML Attributes
<Project> Attributes
ProjectId
– Unique identifier for the project
ProgramId
– Unique identifier for the program
ProjectNumber
– The project number. Projects are assigned a project number when they have been submitted.
<Status> Attributes
StatusId
– Unique identifier for the status
CustomId
– Custom, admin-provided, unique identifier for the status
Name
– Status name
Timestamp
– Timestamp of when the project entered the given status. Converted to user’s local timezone.
// Retrieve the status history for the given project.
// Returns a list of <StatusId, StatusName, Timestamp> tuples, one for each status change.
public List<Tuple<string, string, string>> GetStatusHistory(string programId, string projectId, string username, string password, string apiKey)
{
string url = "/Programs/" + programId + "/Projects/" + projectId + "/StatusHistory";
XDocument xmlResponse = MakeGetRequest(BaseUrl + url, username, password, apiKey);
XNamespace ns = "http://services.powerclerk.com/api/v1/";
List<XElement> statusElements = xmlResponse.Descendants(ns + "Status").ToList();
List<Tuple<string, string, string>> statusInfo = new List<Tuple<string, string, string>>();
foreach (XElement element in statusElements)
{
string statusId = element.Attribute("StatusId").Value;
string statusName = element.Attribute("Name").Value;
string timestamp = element.Attribute("Timestamp").Value;
statusInfo.Add(new Tuple<string, string, string>(statusId, statusName, timestamp));
}
return statusInfo;
}
function getStatusHistory(programId, projectId) {
// Use $.ajax jQuery method to execute the API call
$.ajax({
type: "GET",
url: "https://{BaseURL}/Programs/" + programId + "/Projects/" + projectId + "/StatusHistory",
dataType: "xml",
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic " + hashedCredentials);
xhr.setRequestHeader("X-ApiKey", apiKey);
},
success: function (xml) {
// Display data
},
error: function (xhr) {
// Display error
}
});
}
What’s Next?