Imports multiple policy license rules from a CSV file into the specified policy profile.
CSV Format Requirements:
- Required Headers:
License Short Name,Distribution Type,Linking,Modified,Action - All rows are validated before applying any changes (atomic operation)
- Upsert semantics: updates existing combinations, adds new ones, preserves unmatched existing rows
Valid Values:
- Distribution Type: Any, Internal, External, Hosted-Any, Hosted for External Use, Hosted for Internal Use
- Linking: Any, Statically Linked, Dynamically Linked, Not Linked
- Modified: Any, Yes, No
- Action: Approve, Reject, No Action
CSV Example:
License Short Name,Distribution Type,Linking,Modified,Action
Apache-2.0,Any,Any,Any,Approve
GPL-3.0,External,Dynamically Linked,No,Reject
MIT,Internal,Any,Any,ApproveAuthentication: This API requires a valid JWT Bearer token with Policy Administrator permission.
Try it out is not available for this API. Test using curl or Postman:
curl -H "Authorization: Bearer {JWT_TOKEN}" \
-F file=@licenses.csv \
http://localhost:8888/codeinsight/api/policies/{policyId}/bulkImportValidation Rules:
- All license short names must exist in the reference data
- Duplicate combinations within the CSV are rejected
- Empty rows are skipped
- If ANY validation error exists, NO changes are applied
Response Details:
- Success: Returns count of imported/updated rules
- Failure: Returns detailed row-level validation errors
Security
bearerAuth
- Mock serverhttps://codeinsightapi.redocly.app/_mock/swagger/policies/{policyId}/bulkImport
- Code Insight REST API Serverhttps://codeinsightapi.redocly.app/codeinsight/api/policies/{policyId}/bulkImport
curl -i -X POST \
https://codeinsightapi.redocly.app/_mock/swagger/policies/1/bulkImport \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: multipart/form-data' \
-F 'file={"type":"string","parameters":{"property1":"string","property2":"string"},"fileName":"string","creationDate":"2019-08-24T14:15:22Z","modificationDate":"2019-08-24T14:15:22Z","readDate":"2019-08-24T14:15:22Z","size":0,"name":"string"}'Import successful or validation errors returned
Response
{ "success": true, "message": "Import completed successfully.", "successCount": 42, "errorCount": 0, "errors": [ { … } ] }