Interacting with SysReptor findings
Now let us look at how to add data to projects. Let's create a finding.
Create finding | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 |
|
The input finding dictionary consists of metadata (like status
, assignee
, etc.) and the actual finding data (your finding fields). Add the data you want to add to your finding fields into the data
dictionary. The keys map to the finding IDs from your project designs.
Now let's update the finding that we just created. The FindingRaw object has an ID that we can use for referencing the finding that we want to update.
We'll just fill out the summary
field and change the status
to finished
.
Update the finding we just created | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
The update_finding
method returns the updated FindingRaw objects.
We can use the FindingRaw object to duplicate our finding...
Duplicate finding | |
---|---|
1 2 3 |
|
...or to delete it.
Delete finding | |
---|---|
1 |
|
We can also create new findings from finding templates. For this, we introduce the Finding Templates API.
Searching for finding templates works the same way as searching for projects.
Search finding templates | |
---|---|
1 2 3 4 5 6 |
|
The search returns a list of FindingTemplate objects. We now use the finding template ID to create a new finding from the template.
Create finding from templates | |
---|---|
1 2 3 4 |
|
We might also want to update report fields in our report sections.
We get access to available Sections and report fields through the project.
Get available sections and report fields | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
Use this data to update fields in the section scope
.
Update report fields | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
As we now filled in all relevant data, we now want to download our rendered PDF report.
Render report and save as file | |
---|---|
1 2 |
|
Finally, we can finish, or delete our projects.
Finish or delete projects | |
---|---|
1 2 3 |
|
We can also duplicate projects.
Duplicate project | |
---|---|
1 2 |
|
The duplicate_project
method returns the newly created Project. If you now want to interact with that project, you need to re-initialize your reptor
object.
Switch project after duplicate | |
---|---|
1 2 |
|
If you want to duplicate a project to interact with it and want to clean it up right away, you can also use the contect manager duplicate_and_cleanup
.
The following code snippet duplicates the project, changes the design and renders the PDF. When leaving the context menu, the duplicated project is cleaned up.
Duplicate project and render with alternative design | |
---|---|
1 2 3 4 5 6 |
|
The force
parameter in update_project_design
forces the design change, even if there are incompatible field definitions (e.g., a string
finding field in the original design, which is a number
in the new design would lead to data loss). This makes duplicating the project useful, because incompatibilities won't affect the original project.