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
SubmitProject
Submits a given project. Requires write access to the project and its associated program.
HTTP verb: POST
Required inputs: ProgramId, ProjectId, FormId
HTTP verb: POST
Required inputs: ProgramId, ProjectId, FormId
URL Format
Format:
Sample:
Sample if a custom ID of e.g. “MyForm” has been set:
https://{BaseURL}/Programs/{ProgramId}/Projects/{ProjectId}/Forms/{FormId}/Submit
Sample:
https://{BaseURL}/Programs/1HF29X4P/Projects/YA6XD8U4QG/Forms/Q60TV2AF/Submit
Sample if a custom ID of e.g. “MyForm” has been set:
https://{BaseURL}/Programs/1HF29X4P/Projects/YA6XD8U4QG/Forms/MyForm/Submit
<ProjectSubmitResponse>
<Project ProjectId="JC8SR659PV" ProgramId="1HF29X4P" ProjectNumber="TEST-00011" Status="Application in Process" StatusTimestamp="2014-10-24T16:27:51-07:00" LastChangeTimestamp="2014-10-24T16:27:34-07:00"/>
<Url Value="http://testagency.powerclerk.com/Projects/ProjectList?ProgramId=1HF29X4P"/>
</ProjectSubmitResponse>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.powerclerk.com/api/v1/">
<xs:element name="ProjectSubmitResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Project">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="ProjectId" use="required"/>
<xs:attribute type="xs:string" name="ProgramId" use="required"/>
<xs:attribute type="xs:string" name="ProjectNumber" use="required"/>
<xs:attribute type="xs:string" name="Status" use="required"/>
<xs:attribute type="xs:dateTime" name="StatusTimestamp" use="required"/>
<xs:attribute type="xs:dateTime" name="LastChangeTimestamp" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Url">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:anyURI" name="Value" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:float" name="SchemaVersion"/>
</xs:complexType>
</xs:element>
</xs:schema>
Response XML Attributes
<Project> Attributes
ProjectId
– Unique identifier for the project
ProgramId
– Unique identifier for the program
ProjectNumber
– The project number. Projects are assigned a project number when they have been submitted.
Status
– Name of the current status of the project
StatusTimestamp
– Timestamp of when the project entered the current status. Converted to user’s local timezone.
LastChangeTimestamp
– Timestamp of the last change made to the project. Converted to user’s local timezone.
<Url> Attributes
Value
– The URL for this program’s project list
// Submit the given form for the given project.
// Returns the assigned project number, or null if there was an error and no project number was
// assigned.
public string SubmitProject(string programId, string projectId, string formId, string username, string password, string apiKey)
{
string url = "/Programs/" + programId + "/Projects/" + projectId + "/Forms/" + formId +
"/Submit";
XDocument xmlResponse = MakePostRequest(BaseUrl + url, null, username, password, apiKey);
XNamespace ns = "http://service.powerclerk.com/api/v1/";
List<XElement> projectElements = xmlResponse.Descendants(ns + "Project").ToList();
// Check that the response was successful. In the case of success, the call will return a
// single Project element that indicates the project’s new status.
if (projectElements.Count == 1)
{
string projectNumber = projectElements[0].Attribute("ProjectNumber").Value;
return projectNumber;
}
return null;
}
function submitProject(programId, projectId, formId) {
// Use $.ajax jQuery method to execute the API call
$.ajax({
type: "POST",
url: "https://{BaseURL}/Programs/" + programId + "/Projects/" + projectId + "/Forms/" + formId + "/Submit",
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 MakePostRequest sample code.
What’s Next?