The ProcForms API endpoint returns a list of forms for a given process. The fields returned for each form are based on the View ID provided. If the ViewID is not provided, the user’s default view is used.
Views in RPM
Views in RPM are used to show a list of forms in a process. The user has the freedom to select the visible fields and the order they’re in.
Clicking the “Edit view” button shows all the configurations possible in views, including the fields to show (highlighted in red):
Getting the View ID
RPM provides a section where it lists all the available views and the necessary IDs in ProcForms. To get to it go to the “Setup” section, click on the API button on the sidebar.
In the API page, there’s a “List of view IDs” link on the sidebar:
This page contains a list of all available views on a process. The user can select the process in the picker on the top left. Each row shown is one of the available views:
Using this information
With this information, the ProcForms endpoint can be called to provide the necessary data:
1 2 3 4 5 6 7 | POST http:
RpmApiKey: 59a9a351-612d-4233-b610-134a7bca88b6
{
"ProcessID" : 1,
"ViewID" : 905
}
|
The response of this request looks something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | {
"Result" : {
"Process" : "Work Permits" ,
"ProcessID" : 1,
"View" : "Work information" ,
"Columns" : [
"Number" ,
"Start Date" ,
"Short Description" ,
"Complete Description"
],
"Forms" : [
{
"FormID" : 3,
"Values" : [
"0003" ,
"3/4/2015 12:00:00 AM" ,
"Pipeline inspection in section C" ,
"Small leaks have been reported recently in section C pipelines, the works shall do a visual inspection to find any other leaks or rusted junctions and sections where new leaks could happen.\r\n\r\nAlso should look for any possible sources for these leaks (other than rusting)."
]
},
{
"FormID" : 2,
"Values" : [
"0002" ,
"3/6/2015 12:00:00 AM" ,
"Weekly Workshop Cleanup" ,
"Follow workshop cleanup checklist"
]
},
{
"FormID" : 1,
"Values" : [
"0001" ,
"3/19/2015 12:00:00 AM" ,
"Pump replacement at location ZZRP-1024" ,
"Replace the sump pump for the downstream reservoir"
]
}
]
}
}
|
Sending the same request without providing the ViewID will generate different results:
1 2 3 4 5 6 7 | POST http:
host: localhost
RpmApiKey: 59a9a351-612d-4233-b610-134a7bca88b6
{
"ProcessID" : 1
}
|
In this case, the results contain the fields included in the user’s default view:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | {
"Result" : {
"Process" : "Work Permits" ,
"ProcessID" : 1,
"View" : "All" ,
"Columns" : [
"Number" ,
"Owner" ,
"Action due for me" ,
"Started" ,
"Started by" ,
"Modified" ,
"Modified by" ,
"Files"
],
"Forms" : [
{
"FormID" : 3,
"Values" : [
"0003" ,
"RPM Support" ,
"False" ,
"3/2/2015 2:47:41 PM" ,
"RPM Support" ,
"3/2/2015 2:47:41 PM" ,
"RPM Support" ,
""
]
},
{
"FormID" : 2,
"Values" : [
"0002" ,
"RPM Support" ,
"False" ,
"3/2/2015 2:44:47 PM" ,
"RPM Support" ,
"3/2/2015 2:44:47 PM" ,
"RPM Support" ,
""
]
},
{
"FormID" : 1,
"Values" : [
"0001" ,
"RPM Support" ,
"False" ,
"3/2/2015 2:43:46 PM" ,
"RPM Support" ,
"3/2/2015 2:43:46 PM" ,
"RPM Support" ,
""
]
}
]
}
}
|