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

GetPrograms

Retrieves a list of programs associated that are read-accessible to the user.
 
HTTP verb: GET
 

Query string parameters
Name Data Type Required/Optional Description
Agency String Optional If the optional “Agency” parameter is set, then only programs of that respective agency will be retrieved.
Filter String Optional If the optional “Filter” parameter is set only programs that meet the filter criteria will be retrieved.
Filter Content
Production Production programs will be retrieved
Test Test environment programs will be retrieved

URL Format

Format: https://{BaseURL}/Programs&Filter={Filter}
Sample: https://{BaseURL}/Programs
 https://{BaseURL}/Programs?Filter=Test
 https://{BaseURL}/Programs?Filter=Production

Response


<ProgramsResponse>
 <Programs>
  <Program ProgramId="A43FN6BR" AgencyId="7JWS463" ProgramName="Residential Solar Interconnection Program" AgencyName="Figment Light and Power" />
  <Program ProgramId="1HF29X4P" AgencyId="7JWS463" ProgramName="Commercial Solar Interconnection Program" AgencyName="Figment Light and Power" />
 </Programs>
</ProgramsResponse>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
  <xs:element name="ProgramsResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Programs">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Program" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="ProgramId" use="required"/>
                        <xs:attribute type="xs:string" name="AgencyId" use="required"/>
                        <xs:attribute type="xs:string" name="ProgramName" use="required"/>
                        <xs:attribute type="xs:string" name="AgencyName" use="required"/>
                      </xs:extension>
                    </xs:simpleContent>
                  </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>

Response XML Attributes

ProgramId – Unique identifier for the program
AgencyId – Unique identifier for the agency
ProgramName – Program name
AgencyName – Agency name

Sample Code


// Retrieves info about all programs in a given agency.
// Returns a list of <ProgramId, ProgramName> pairs, one for each program in the list.

public List<Tuple<string, string>> GetProgramInfo(string agencyId, string username, string password, string apiKey)
{
    string url = "/Programs?Agency=" + agencyId;
    XDocument xmlResponse = MakeGetRequest(BaseUrl + url, username, password, apiKey);

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

    List<Tuple<string, string>> programs = new List<Tuple<string, string>>();
    foreach (XElement programElement in programElements)
    {
        string programId = programElement.Attribute("ProgramId").Value;
        string programName = programElement.Attribute("ProgramName").Value;
        programs.Add(new Tuple<string,string>(programId, programName));
    }
    return programs;
}


function getPrograms(agencyId) {
    // Use $.ajax jQuery method to execute the API call
    $.ajax({
        type: "GET",
        url: "https://{BaseURL}/Programs?Agency=" + agencyId,
        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?