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

SetAttachmentMetadata

Upload metadata for an attachment for a given project. Requires admin write access to the project.
 
HTTP verb: POST
 
Required inputs: ProgramId, ProjectId, AttachmentId
 
AttachmentStatus options: Mapping of request AttachmentStatus to ApprovalStatus response in metadata.
 

AttachmentStatus Request ApprovalStatus Response
Approve Approved
Reject Rejected
Unmark Pending
Save {Do not change Attachment Approval Status}

URL Format

Format: https://{BaseURL}/Programs/{ProgramId}/Projects/{ProjectId}/Attachments/{AttachmentId}/Metadata
 
Sample: https://{BaseURL}/Programs/1HF29X4P/Projects/HRR5RZ43WGUQ/Attachments/3QX3VQ18/Metadata
 
Sample if the attachment has a custom ID of “MyAttachment”:
https://{BaseURL}/Programs/1HF29X4P/Projects/HRR5RZ43WGUQ/Attachments/MyAttachment/Metadata
 

Sample Request

Note: Request payloads must include the namespace “http://service.powerclerk.com/api/v1” (see below).


<SetAttachmentMetadata xmlns="http://service.powerclerk.com/api/v1/" AttachmentStatus="Approve" Note="Document is in order">
</SetAttachmentMetadata>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
  <xs:element name="SetAttachmentMetadata">
    <xs:complexType>
      <xs:attribute type="xs:string" name="AttachmentStatus" use="optional"/>
      <xs:attribute name="Note" use="optional">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value= "2048"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>

Request XML Attributes

AttachmentStatus – Optional. Mark the status of the current attachment.
Note – Optional. Notes are notes to the Applicant used to explain why a document was rejected. Notes have a maximum length of 2048 characters.

Sample Response


<AttachmentMetadataResponse xmlns="http://service.powerclerk.com/api/v1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <AttachmentMetadata AttachmentId="3QX3VQ18" AttachmentName="Copy Of Utility Bill" FileName="1test.pdf" FileSize="23485" ApprovalStatus="Approved" Note="Document is in order" UploadTimestamp="2017-03-23T09:46:25-07:00" UploadedById="XXXXXXXXXXXX" UploadedByEmailAddress="solar@cleanpower.com" />
</AttachmentMetadataResponse>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
  <xs:element name="AttachmentMetadataResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="AttachmentMetadata">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="AttachmentId" use="required"/>
                <xs:attribute type="xs:string" name="CustomId" use="optional"/>
                <xs:attribute type="xs:string" name="AttachmentName" use="required"/>
                <xs:attribute type="xs:string" name="FileName" use="required"/>
                <xs:attribute type="xs:string" name="FileSize" use="required"/>
                <xs:attribute type="xs:string" name="ApprovalStatus" use="required"/>
                <xs:attribute type="xs:string" name="Note" use="required"/>
                <xs:attribute type="xs:string" name="UploadTimestamp" use="required"/>
                <xs:attribute type="xs:string" name="UploadedByEmailAddress" use="required"/>
                <xs:attribute type="xs:string" name="UploadedById" use="required"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Response XML Attributes

AttachmentId – Unique identifier for the attachment
CustomId – Optional, admin-determined unique identifier for the attachment
AttachmentName – UAttachment Name
FileName – Attachment filename
FileSize – FileSize of the document in bytes
UploadTimestamp – Timestamp of when the attachment was uploaded. Converted to user’s local timezone.
UploadedByEmailAddress – Email Address of the user who uploaded the document.
UploadedById – UserId of the user who uploaded the document.

Sample Code


Public XmlDocument SetAttachmentMetadata(string programId, string projectId, string username, string password, string apiKey, string attachmentId)
{
    XDocument xDocument = new XDocument( new XElement(ns + "SetAttachmentMetadata", new XAttribute("AttachmentStatus", "Approve"), new XAttribute("Note", "Document is in order")));

    XmlDocument requestPayload = new XmlDocument();
    using (XmlReader xmlReader = xDocument.CreateReader())
    {
        requestPayload.Load(xmlReader);
    }
    string url = BaseUrl + "/Programs/" + programId + "/Projects/" + projectId + "/Attachments/" + attachmentId + "/Metadata";

    XDocument xmlResponse = MakePostRequest(BaseUrl + url, username, password, apiKey, requestPayload);

    return xmlResponse;
}

See Chapter Code Samples for MakePostRequest sample code.

What’s Next?