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
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
Code Samples
EncodeAuthorizationHeader
MakeGetRequest
MakePostRequest
MakeGetFileRequest
MakeDeleteRequest
PowerShell

GetAttachmentMetadata

Get the metadata for an attachment for a given project. Requires read access to the project.
 
HTTP verb: GET
Required inputs: ProgramId, ProjectId, FormId

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 customID of “MyAttachment”:
ttps://{BaseURL}/Programs/1HF29X4P/Projects/HRR5RZ43WGUQ/Attachments/MyAttachment/Metadata
 

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>

Same as response to 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="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 – Attachment 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 string GetApprovalStatus(string programId, string projectId, string attachmentId, string username, string password, string apiKey)
{
    string url = "/Programs/" + programId + "/Projects/" + projectId + "/Attachments/" + attachmentId + "/Metadata";
    XDocument xmlResponse = MakeGetRequest(BaseUrl + url, username, password, apiKey);

    XNamespace ns = "http://service.powerclerk.com/api/v1/";

    var metadata = xmlResponse.Descendants(ns + "AttachmentMetadata").First();
    string approvalStatus = metadata.Attribute("ApprovalStatus").Value;
    return approvalStatus;
}

What’s Next?