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
CreateNewProject
Creates a new, empty project in the given program, as well as a list of the forms available for the project. Requires write access to the program.
HTTP verb: POST
Required inputs: ProgramId
HTTP verb: POST
Required inputs: ProgramId
<ProjectCreateResponseFacade1>
<Project ProjectId="TY4XZ5QQ1N" ProgramId="1HF29X4P" Status="Unsubmitted" StatusTimestamp="2014-10-24T12:15:17-07:00" LastChangeTimestamp="2014-10-24T12:15:17.687164-07:00">
<Url Value="http://testagency.powerclerk.com/Projects/ProjectList?ProgramId=1HF29X4P"/>
<Forms>
<Form FormId="PE1TP81B" ProgramId="1HF29X4P" Title="Interconnection Application">
<AvailableInStatuses>
<Status StatusId="3X8KK600" Name="Unsubmitted"/>
</AvailableInStatuses>
<LeadsToStatus StatusId="SE0BU2DG" Name="Application in Process"/>
</Form>
<Form FormId="2RN3XR30" ProgramId="1HF29X4P" Title="Supporting Documentation">
<AvailableInStatuses>
<Status StatusId="VZ8A5QD4" Name="Awaiting Documentation"/>
</AvailableInStatuses>
<LeadsToStatus StatusId="759NA6NH" Name="Inspection Pending"/>
</Form>
<Form FormId="FD78C9G2AV" ProgramId="1HF29X4P" Title="Net Meter Request">
<AvailableInStatuses>
<Status StatusId="93JH4U3Z" Name="Set Meter Request Pending"/>
</AvailableInStatuses>
</Form>
</Forms>
</Project>
</ProjectCreateResponseFacade1>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
<xs:element name="ProjectCreateResponseFacade1 ">
<xs:complexType>
<xs:sequence>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Url">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:anyURI" name="Value"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Forms">
<xs:complexType>
<xs:sequence>
<xs:element name="Form" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="AvailableInStatuses">
<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:boolean" name="Deleted" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="LeadsToStatus" 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:boolean" name="Deleted" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="FormId" use="required"/>
<xs:attribute type="xs:string" name="CustomId" use="optional"/>
<xs:attribute type="xs:string" name="ProgramId" use="required"/>
<xs:attribute type="xs:string" name="Title" use="required"/>
</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="Status" use="required"/>
<xs:attribute type="xs:dateTime" name="StatusTimestamp" use="required"/>
<xs:attribute type="xs:dateTime" name="LastChangeTimestamp" use="required"/>
</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
Status
– Current status of the project
StatusTimestamp
– Timestamp of when the project entered the current status. Converted to user’s local timezone.
LastChangeTimestamp
– Timestamp of the last change made to the project. Converted to user’s local timezone.
<Form> Attributes
FormId
– Unique identifier for the form
ProgramId
– Unique identifier for the program
Title
– Form title
<AvailableInStatuses> and <LeadsToStatus>
<AvailableInStatuses>
– A list of statuses in which the form is available
<LeadsToStatus>
– Successful submission of the form will move a project into this status
<Status> Attributes
StatusId
– Unique identifier for the status
Name
– Status name
// Creates a new project in the given program.
// Returns the ProjectId of the new project.
public string CreateNewProject(string programId, string username, string password, string apiKey)
{
string url = "/Programs/" + programId + "/NewProject";
XDocument xmlResponse = MakePostRequest(BaseUrl + url, null, username, password, apiKey);
XNamespace ns = "http://service.powerclerk.com/api/v1/";
XElement projectElement = xmlResponse.Descendants(ns + "Project").ToList()[0];
string projectId = projectElement.Attribute("ProjectId").Value;
return projectId;
}
function createNewProject(programId) {
// Use $.ajax jQuery method to execute the API call
$.ajax({
type: "POST",
url: "https://{BaseURL}/Programs/" + programId + "/NewProject",
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
}
});
}
See Chapter Code Samples for MakePostRequest sample code.
What’s Next?