PCAPs endpoint
A GET request to /api/open/pcaps allows you to get the list of all
traces available on the machine.
This endpoint lets you to interact with packet capture (pcap)s that have been uploaded to Guardian from the Upload traces page of the System section.

A GET request to /api/open/pcaps/:id allows you to retrieve a given trace.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- In case the request body does not adhere to the format described above, the call
returns a
422error. - If you specify an identifier (ID) of a trace that does not exist, the call returns a
404error. - If the request is accepted, the result will contain information on the retrieved trace.


A DELETE request to /api/open/pcaps/:id allows you to delete a given
trace.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- In case the request body does not adhere to the format described above, the call
returns a
422error. - If you specify an ID of a trace that does not exist, the call returns a
404error. - If the request is accepted, the trace will be deleted.

A POST request to /api/open/pcaps/upload allows you to upload a
trace passed as a file in the body of the request.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- The trace should be passed in the
form-datasection of the request body. - In case the request body does not adhere to the format described above, the call
returns a
422error. - If the file sent in the request is not a valid trace, the call returns a
422error along with an error reason describing the cause of the validation failure. - If the request is accepted, the trace will be uploaded.

A POST request to /api/open/pcaps/import allows you to import a
trace file that is already present in the machine.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- The trace file should be present in the
/data/tmpdirectory of the machine. - The
filenameparameter of the request should contain the name of the trace file. - In case the request body does not adhere to the format described above, the call
returns a
422error. - If the trace file is not a valid trace, the call returns a
422error along with an error reason describing the cause of the validation failure. - If the request is accepted, the trace will be uploaded.

A PATCH request to /api/open/pcaps allows you to replay a trace that
has been previously uploaded or imported.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- The trace should be present in the list of the available traces returned by the
GET request to
/api/open/pcaps. - The
idparameter of the request should contain the ID of the trace. - The
use_packet_timeboolean parameter should be set totrueif you want to use the time of the packets;falseotherwise. - The
data_to_reset_before_playparameter should be set to{}if you do not want to reset data before playing the trace. Otherwise, you need to specify a JavaScript Object Notation (JSON) dictionary with the sections you want to reset, for example{"alerts": true, "vi": true}. The list of all available sections is the following:- alerts_data
- assertions
- learning
- network_data
- process_data
- queries
- smart_polling_data
- timemachine_data
- traces_data
- vi_data
- vulnerability_data
- In case the request body does not adhere to the format described above, the call
returns a
422error. - If you specify an ID of a trace that does not exist, the call returns a
404error. - If the request is accepted, the trace will be replayed.

A PATCH request to /api/open/pcaps/note allows you to change the
note field of a trace.
Requirements and Restrictions
- The authenticated user must be in a group having admin role or with Upload traces section enabled.
- The trace should be present in the list of the available traces returned by the
GET request to
/api/open/pcaps. - The
idparameter of the request should contain the ID of the trace. - The
noteparameter of the request should contain the text you want to change. - In case the request body does not adhere to the format described above, the call
returns a
422error. - If the request is accepted, the note will be changed.
