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
GetPrograms
Retrieves a list of programs associated that are read-accessible to the user.
HTTP verb: GET
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 |
<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>
// 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?