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
 
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
					HTTP verb: GET
Required inputs: ProgramId, ProjectId, FormId
URL Format
Format: 
 
Sample:
 
Sample if the Attachment has a customID of “MyAttachment”:
 
					https://{BaseURL}/Programs/{ProgramId}/Projects/{ProjectId}/Attachments/{AttachmentId}/MetadataSample:
https://{BaseURL}/Programs/1HF29X4P/Projects/HRR5RZ43WGUQ/Attachments/3QX3VQ18/MetadataSample if the Attachment has a customID of “MyAttachment”:
https://{BaseURL}/Programs/1HF29X4P/Projects/HRR5RZ43WGUQ/Attachments/MyAttachment/Metadata
<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 attachmentCustomId – Optional, admin-determined unique identifier for the attachmentAttachmentName – Attachment NameFileName – Attachment filenameFileSize – FileSize of the document in bytesUploadTimestamp – 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.
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?