Curl is a multi-platform command-line tool used to transfer data using multiple protocols. This tool is supported on many systems, including Windows, Unix, Linux, and Mac. In this document, Curl is used in the examples to build Qualys API requests using the HTTP over SSL (https) protocol, which is required.
Want to learn more? Visit https://curl.haxx.se/
The following Curl options are used according to different situations:
Options |
Description |
---|---|
-X GET/POST/DELETE |
The GET, POST, DELETE method are used as per requirement. |
-H 'Authorization: Bearer <token>' |
This option is used to provide a custom HTTP request header parameter for authentication. Provides the JSON Web Token (JWT) received from Qualys authentication API in the following format: Authorization: Bearer <token> |
-H 'content-type: application/json' |
Denotes that content is in JSON format. |
-H 'Content-Type: text/plain' |
Denotes that content is in text or plain format. |
-d @request.json |
Provide a request.json file for parameter input. |
--data-urlencode |
Used to encode spaces and special characters in the URL/Parameter values. |
The sample below shows a typical Curl request using the above mentioned options and how they interact.
Sample Curl Request
curl -X GET 'http://<api_gateway_url>/ocaapi/v2.0/technology/PolicyCompliance' -H 'Content-Type: application/json' -H 'Authorization: Bearer '