Application & Process Automation

Getting Started
Authentication & Access
Accounts with Multi-Factor Authentication
Using method GetPrograms
Common Usage Scenarios
Create and Submit a Project
Add/Change Data in an Existing Project
Daily Polling for Project Changes
Troubleshooting
Using Custom IDs
API Method Reference
GetPrograms
URL Format
Response
XML Attributes
Sample Code
GetForms
URL Format
Response
Forms Attributes
AvailableInStatuses and LeadsToStatus
Status Attributes
Sample Code
GetFormSchema
V1 Response
V2 Response
Sample Code
GetProjects
V1 Response
V2 Response
V3 Response
Sample Code
GetProjectsByNumber
V1 Response
V2 Response
Sample Request
Sample Code
GetProjectsByData
Sample Request
Request XML Nodes and Attributes
V1 Response
V2 Response
CreateNewProject
Sample Response
Response XML Attributes
Sample Code
GetAllProjectData - Admin only
Sample Response
XML Attributes
Sample Code
GetProjectData
Sample Response
XML Attributes
Sample Code
SetProjectData
Sample Request
Request XML Attributes
Sample Response
Response XML Attributes
Sample Code
GetActiveAttachment
URL Format
Sample Code
GetAttachmentAsAdmin – Admin only
URL Format
SetProjectAttachment
Identifying attachment file types
URL Format
Sample Response
Response XML Attributes
Sample Code
SetAttachmentMetadata
Sample Request
Request XML Attributes
Sample Response
Response XML Attributes
Sample Code
GetAttachmentMetadata
URL Format
Sample Response
Response XML Attributes
Sample Code
SubmitProject
URL Format
Sample Response
Response XML Attributes
Sample Code
GetStatusList – Admin only
Sample Code
URL Format
Sample Response
Response XML Attributes
GetCustomListChoices
URL Format
Sample Response
Response XML Attributes
GetProjectStatusHistory – Admin only
URL Format
Sample Response
Response XML Attributes
Sample Code
SetProjectStatus – Admin only
URL Format
Sample Response
Response XML Attributes
Sample Code
GetExportProject – Admin only
Response XML Attributes
Sample Code
URL Format
Sample Response
CreateMfaSessionToken
URL Format
Sample Request
Request XML Attributes
Sample Response
Response XML Attributes
Sample Code
DeleteMfaSessionToken
URL Format
Sample Response
Sample Code
SetAssignee
URL Format
Sample Request
Request XML Attributes
Sample Response
Response XML Attributes
SetProjectOwner
URL Format
Sample Request
Request XML Attributes
Sample Response
Response XML Attributes
GetInquiryThreads – Admin Only
GetNotesInInquiryThread – Admin Only
SetInquiryNote – Admin Only
SetInquiryThreadStatus – Admin Only
SetInquiryThreadExternalId – Admin Only
SetProjectStatusReportAs – Admin only
Code Samples
EncodeAuthorizationHeader
MakeGetRequest
MakePostRequest
MakeGetFileRequest
MakeDeleteRequest
PowerShell

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

URL Format

Format: https://{BaseURL}/Programs/{ProgramId}/NewProject
 
Sample: https://{BaseURL}/Programs/1HF29X4P/NewProject

Sample Response


<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
 

Sample Code


// 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.