Application & Process Automation

Getting Started
Authentication & Access
Accounts with Multi-Factor Authentication
Agency and Program Information
Common Usage Scenarios
Create and Submit a Project
Add/Change Data in an Existing Project
Daily Polling for Project Changes
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
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
URL Format
Sample Response
Response XML Attributes
Sample Code
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
Code Samples
EncodeAuthorizationHeader
MakeGetRequest
MakePostRequest
MakeGetFileRequest
MakeDeleteRequest
PowerShell

GetForms

Retrieves a list of forms associated with the given program that are read-accessible to the user. For a form to be read-accessible, the user must be a member of a role that has access to the form in at least one workflow status.
 
HTTP verb: GET
Required inputs: ProgramId

URL Format

Format: https://{BaseURL}/Programs/{ProgramId}/Forms
Sample: https://{BaseURL}/Programs/A43FN6B/Forms

Response


<FormsResponse>
    <Forms>
        <Form FormId="PE1TP81B" CustomId="ApplicationForm" 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="UG44KB289X" ProgramId="1HF29X4P" Title="Net Meter System Verification">
            <AvailableInStatuses>
                <Status StatusId="759NA6NH" Name="Inspection Pending"/>
            </AvailableInStatuses>
        </Form>
    </Forms>
</FormsResponse>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
  <xs:element name="FormsResponse">
    <xs:complexType>
      <xs:sequence>
        <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" minOccurs="0" maxOccurs="unbounded">
                            <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:float" name="SchemaVersion"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

<Form> Attributes

FormId – Unique identifier for the form
CustomId – Optional, admin-set unique-within-this-program 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
CustomId – Optional, admin-set unique-within-this-program identifier for the status
Name – Status name

Sample Code


// Retrieves info about all forms in a given program that are accessible to the caller.
// Returns a list of <FormId, FormTitle> pairs, one for each form in the list.

public List<Tuple<string, string>> GetFormInfo(string programId, string username, string password, string apiKey)
{
    string url = "/Programs/" + programId + "/Forms";
    XDocument xmlResponse = MakeGetRequest(BaseUrl + url, username, password, apiKey);

    XNamespace ns = "http://service.powerclerk.com/api/v1/";
    List<XElement> formElements = xmlResponse.Descendants(ns + "Form").ToList();

    List<Tuple<string, string>> forms = new List<Tuple<string, string>>();
    foreach (XElement formElement in formElements)
    {
        string formId = formElement.Attribute("FormId").Value;
        string formName = formElement.Attribute("Title").Value;
        forms.Add(new Tuple<string, string>(formId, formName));
    }
    return forms;
}


function getForms(programId) {
    // Use $.ajax jQuery method to execute the API call
    $.ajax({
        type: "GET",
        url: "https://{BaseURL}/Programs/" + programId + "/Forms",
        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 MakeGetRequest sample code.

What’s Next?