I've used the submit file method to create a new scan on Copyleaks API platform. Using this code:
curl -XPUT -H 'Authorization: Bearer XXX' -H "Content-type: application/json" -d '{
"base64": "SGVsbG8gd29ybGQh",
"filename": "file.txt",
"properties": {
"webhooks": {
"status": "https://yoursite.com/webhook/{STATUS}/my-custom-id"
}
}
}' 'https://api.copyleaks.com/v3/businesses/submit/file/my-custom-id'
I got the completion webhook that said the scan was completed successfully.
How to download the artifacts:
and store it on my server?
Based on this instruction page - Export documentation.
The idea of this method is to allow Copyleaks servers to push all the scan artifacts into customer servers. It's like a PUSH message where the Copyleaks sever is the conversation initiator.
If you are using Cloud Storage (like Google Bucket, Azure Storage or others) you can ask Copyleaks Export method to write directly into them - using Signed URL.
Raw call example:
POST https://api.copyleaks.com/v3/downloads/scan-id/export/export-id
Authorization: Bearer XXX;
{
"results": [
{
"id": "my-result-id",
"verb": "POST",
"headers": [
["header-key", "header-value"]
],
"endpoint": "https://yourserver.com/export/export-id/results/my-result-id"
}
],
"pdfReport": {
"verb": "POST",
"headers": [
["header-key", "header-value"]
],
"endpoint": "https://yourserver.com/export/export-id/pdf-report"
},
"crawledVersion": {
"verb": "POST",
"headers": [
["header-key", "header-value"]
],
"endpoint": "https://yourserver.com/export/export-id/crawled-version"
},
"completionWebhook": "https://yourserver.com/export/export-id/completed",
"maxRetries": 3
}