= SecurityC4PO REST API Documentation
Novatec Consulting GmbH;
: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[]

== Change History

|===
|Date |Change
|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
|===

== Pentest

=== Get pentests by projectId and 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[]