curl --location 'https://api.scanoss.com/api/v2/cryptography/algorithmsInRange' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{
"purls": [
{
"purl": "pkg:maven/org.jetbrains.kotlin/kotlin-gradle-plugin",
"requirement": ">0.5"
}
]
}'
curl --location 'https://api.scanoss.com/api/v2/cryptography/algorithms' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{"purls": [
{
"purl": "pkg:github/torvalds/linux",
"requirement": "v4.0"
},
{
"purl": "pkg:github/scanoss/engine",
"requirement": "4.3"
}
]
}'
curl --location 'https://api.scanoss.com/api/v2/provenance/countries' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{
"purls": [
{
"purl": "pkg:github/scanoss/engine"
}
]
}'
curl --location 'https://api.scanoss.com/api/v2/components/search' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{"search" : "scanoss", "limit": 10 }'
curl --location 'https://api.scanoss.com/api/v2/components/versions' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{"purl": "pkg:github/scanoss/scanoss.js" }'
curl --location 'https://api.scanoss.com/api/v2/dependencies/dependencies' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data '{"files": [{ "purls": [ { "purl":"pkg:npm/wrap-ansi-cjs"} ] } ]}'
curl --location 'https://api.scanoss.com/api/v2/vulnerabilities/cpes' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data-raw '{"purls": [
{
"purl": "pkg:npm/[email protected]"
}
]
}'
curl --location 'https://api.scanoss.com/api/v2/vulnerabilities/vulnerabilities' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <Your access token>' \
--data-raw '{"purls": [
{
"purl": "pkg:npm/[email protected]"
},
{
"purl": "pkg:npm/@ava/typescript"
}
]
}'
To ignore SSL certificate errors when using curl, you can use the -k or --insecure option. This allows curl to perform "insecure" SSL connections. The command would look like this:
curl -k https://example.com
or
curl --insecure https://example.com
If you don't use the --insecure option and encounter a self-signed certificate or an invalid SSL certificate, you might see an error like this:
curl: (60) SSL certificate problem: self-signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
To use a proxy with curl, you can use the -x or --proxy option. The general format is:
curl -x [protocol://]host[:port] URL
- Using HTTP Proxy:
curl -x http://proxy.example.com:8080 https://destination.com
- Using HTTPS Proxy:
curl -x https://proxy.example.com:8080 https://destination.com
- Specifying a username and password for the proxy:
curl -x http://username:[email protected]:8080 http://destination.com
When working in an environment with SSL interception (common in corporate settings), y ou often need to combine the use of a proxy with the ability to ignore SSL certificate errors. Here's how you can do this:
- Obtain the SSL certificate of your proxy server (provided by your IT department).
- Use the following curl command:
curl -x https://proxy.example.com:8080 \
--proxy-cacert /path/to/proxy/certificate.crt \
--insecure \
https://destination.com