Example: Importing a Scan via curl¶
A complete end-to-end example:
# 1. Upload a scan
curl -X POST https://api.trustsource.io/v2/core/scans \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: my-pipeline/1.0.0" \
-d @scan-result.json
# 2. Check scan status
curl -H "x-api-key: YOUR_KEY" \
https://api.trustsource.io/v2/core/scans/SCAN_ID
# 3. Get module components
curl -H "x-api-key: YOUR_KEY" \
https://api.trustsource.io/v2/core/modules/MODULE_ID/partsList
Notes:
POST /core/scansneeds aUser-Agentheader; without it the call fails with400("mandatory User-Agent header missing"). An agent name that TrustSource does not know is accepted; the response then carries aninfonote.- The project named in the scan (
project) must exist, otherwise the call fails with404. The module is created on the first upload. - The response of step 1 carries
scanIdandmoduleIdfor steps 2 and 3. - Uploading needs a key with the
developerormanagerscope; reading the parts list needsmanager,compliance_manager,portfolio_managerorcompany_security_manager. A key with themanagerscope can run all three steps. See Scans and Modules.