= SecurityC4PO REST API Documentation
:doctype: book
:source-highlighter: highlightjs
:icons: font
:toc: left
:toclevels: 4
:sectlinks:
:data-uri:

This documentation describes the REST API for the "SecurityC4PO".

The service tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP verbs and status codes.

== Error handling

You can generally expect 4xx for client errors and 5xx for server errors.

== Request Headers

The request and response snippets shown in this documentation are generated from real interactions.
When creating requests you must not follow the examples exactly, e.g. instead of providing the Accept Header `application/json, application/javascript, text/javascript` you can also provide only one value, typically `application/json`.

== Project

=== Get projects

To get projects, call the GET request /projects

==== Request example

include::{snippets}/getProjects/http-request.adoc[]

==== Response example

include::{snippets}/getProjects/http-response.adoc[]

==== Response structure

include::{snippets}/getProjects/response-fields.adoc[]

=== Save project

To save a project, call the POST request /projects

==== Request example

include::{snippets}/saveProject/http-request.adoc[]

==== Response example

include::{snippets}/saveProject/http-response.adoc[]

==== Response structure

include::{snippets}/saveProject/response-fields.adoc[]

=== Delete project

To delete a project, call the DELETE request /projects/+{projectId}+

==== Request example

include::{snippets}/deleteProject/http-request.adoc[]

==== Request structure

include::{snippets}/deleteProject/path-parameters.adoc[]

==== Response example

include::{snippets}/deleteProject/http-response.adoc[]

If the project has already been deleted "204 No Content" is following.

include::{snippets}/deleteNotExistingProject/http-response.adoc[]

==== Response structure

include::{snippets}/deleteProject/response-fields.adoc[]

=== Update project

To update a project, call the PATCH request /projects/+{projectId}+

==== Request example

include::{snippets}/updateProject/http-request.adoc[]

==== Response example

include::{snippets}/updateProject/http-response.adoc[]

==== Response structure

include::{snippets}/updateProject/response-fields.adoc[]

== Pentest

=== Get pentests for category

To get pentests by projectId and category, call the GET request /pentests with the appropriate parameters.

==== Request example

include::{snippets}/getPentestsByProjectIdAndCategory/http-request.adoc[]

==== Request structure

include::{snippets}/getPentestsByProjectIdAndCategory/request-parameters.adoc[]

==== Response example

include::{snippets}/getPentestsByProjectIdAndCategory/http-response.adoc[]

==== Response structure

include::{snippets}/getPentestsByProjectIdAndCategory/response-fields.adoc[]

=== Save pentest

To save a pentest, call the POST request /pentests/+{projectId}+

==== Request example

include::{snippets}/savePentestByProjectId/http-request.adoc[]

==== Request structure

include::{snippets}/savePentestByProjectId/path-parameters.adoc[]

==== Response example

include::{snippets}/savePentestByProjectId/http-response.adoc[]

==== Response structure

include::{snippets}/savePentestByProjectId/response-fields.adoc[]

=== Update pentest

To update a pentest, call the PATCH request /pentests/+{pentestId}+

==== Request example

include::{snippets}/updatePentestByProjectId/http-request.adoc[]

==== Response example

include::{snippets}/updatePentestByProjectId/http-response.adoc[]

==== Response structure

include::{snippets}/updatePentestByProjectId/response-fields.adoc[]

== Finding

=== Get findings for pentest

To get findings by pentestId, call the GET request /pentests/+{pentestId}+/findings.

==== Request example

include::{snippets}/getFindingsByPentestId/http-request.adoc[]

==== Request structure

include::{snippets}/getFindingsByPentestId/path-parameters.adoc[]

==== Response example

include::{snippets}/getFindingsByPentestId/http-response.adoc[]

==== Response structure

include::{snippets}/getFindingsByPentestId/response-fields.adoc[]

=== Get finding for id

To get a finding by id, call the GET request /pentests/+{findingId}+/finding.

==== Request example

include::{snippets}/getFindingById/http-request.adoc[]

==== Request structure

include::{snippets}/getFindingById/path-parameters.adoc[]

==== Response example

include::{snippets}/getFindingById/http-response.adoc[]

==== Response structure

include::{snippets}/getFindingById/response-fields.adoc[]

=== Save finding

To save a finding, call the POST request /pentests/+{pentestId}+/finding

==== Request example

include::{snippets}/saveFindingByPentestId/http-request.adoc[]

==== Request structure

include::{snippets}/saveFindingByPentestId/path-parameters.adoc[]

==== Response example

include::{snippets}/saveFindingByPentestId/http-response.adoc[]

==== Response structure

include::{snippets}/saveFindingByPentestId/response-fields.adoc[]

=== Update finding

To update a finding, call the PATCH request /pentests/+{findingId}+/finding

==== Request example

include::{snippets}/updateFindingById/http-request.adoc[]

==== Request structure

include::{snippets}/updateFindingById/path-parameters.adoc[]

==== Response example

include::{snippets}/updateFindingById/http-response.adoc[]

==== Response structure

include::{snippets}/updateFindingById/response-fields.adoc[]

=== Delete finding

To delete a finding, call the DELETE request /pentests/+{pentestId}+/finding/+{findingId}+

==== Request example

include::{snippets}/deleteFindingByPentestAndFindingId/http-request.adoc[]

==== Request structure

include::{snippets}/deleteFindingByPentestAndFindingId/path-parameters.adoc[]

==== Response example

include::{snippets}/deleteFindingByPentestAndFindingId/http-response.adoc[]

==== Response structure

include::{snippets}/deleteFindingByPentestAndFindingId/response-fields.adoc[]

== Comment

=== Get comments for pentest

To get comments by pentestId, call the GET request /pentests/+{pentestId}+/comments.

==== Request example

include::{snippets}/getCommentsByPentestId/http-request.adoc[]

==== Request structure

include::{snippets}/getCommentsByPentestId/path-parameters.adoc[]

==== Response example

include::{snippets}/getCommentsByPentestId/http-response.adoc[]

==== Response structure

include::{snippets}/getCommentsByPentestId/response-fields.adoc[]

=== Save comment

To save a comment, call the POST request /pentests/+{pentestId}+/comment

==== Request example

include::{snippets}/saveCommentByPentestId/http-request.adoc[]

==== Request structure

include::{snippets}/saveCommentByPentestId/path-parameters.adoc[]

==== Response example

include::{snippets}/saveCommentByPentestId/http-response.adoc[]

==== Response structure

include::{snippets}/saveCommentByPentestId/response-fields.adoc[]

=== Delete comment

To delete a comment, call the DELETE request /pentests/+{pentestId}+/comment/+{commentId}+

==== Request example

include::{snippets}/deleteCommentByPentestAndCommentId/http-request.adoc[]

==== Request structure

include::{snippets}/deleteCommentByPentestAndCommentId/path-parameters.adoc[]

==== Response example

include::{snippets}/deleteCommentByPentestAndCommentId/http-response.adoc[]

==== Response structure

include::{snippets}/deleteCommentByPentestAndCommentId/response-fields.adoc[]

=== Get comment for id

To get a comment by id, call the GET request /pentests/+{commentId}+/comment.

==== Request example

include::{snippets}/getCommentById/http-request.adoc[]

==== Request structure

include::{snippets}/getCommentById/path-parameters.adoc[]

==== Response example

include::{snippets}/getCommentById/http-response.adoc[]

==== Response structure

include::{snippets}/getCommentById/response-fields.adoc[]

=== Update comment

To update a comment, call the PATCH request /pentests/+{commentId}+/comment

==== Request example

include::{snippets}/updateCommentById/http-request.adoc[]

==== Request structure

include::{snippets}/updateCommentById/path-parameters.adoc[]

==== Response example

include::{snippets}/updateCommentById/http-response.adoc[]

==== Response structure

include::{snippets}/updateCommentById/response-fields.adoc[]


== Change History

|===
|Date |Change
|2022-12-28
|Added GET, PATCH endpoint for Comment
|2022-12-23
|Added DELETE endpoint for Comment
|2022-12-22
|Added GET, POST endpoint for Comment(s)
|2022-12-09
|Added DELETE endpoint for Finding
|2022-12-08
|Added GET and PATCH endpoint for Finding
|2022-12-02
|Added GET and POST endpoint for Finding(s)
|2022-11-21
|Added GET, POST and PATCH endpoint for Pentests
|2022-03-07
|Added PATCH endpoint to update Projects
|2022-02-01
|Added DELETE endpoint to save Projects
|2021-12-22
|Added POST endpoint to save Projects
|2021-02-14
|Added GET endpoint to receive Projects
|2021-02-12
|Initial version
|===
