API endpoint to submit free text to the copyleaks plagiarism API

119 Views Asked by At

I went through the API docs on this page: https://api.copyleaks.com/documentation/v3/scans

one can submit 3 types of data - url, file and ocr data to the plagiarism checker api. I would like to know how to submit free text to the API. I am able to do so via the UI but cannot figure out the API endpoint.

EDIT: I unblocked myself by pasting all the sentences together in 1 file and passing that to copyleaks api.

1

There are 1 best solutions below

0
On BEST ANSWER

Submitting free text scan done by using the Submit by file endpoint.

Free text need to be converted to its base64 representation. For example:

"Hello world" -> "SGVsbG8gd29ybGQ="

Than, this base64 text is working like any text file.

curl -XPUT -H "Authorization: Bearer YOUR-LOGIN-TOKEN" -H "Content-type: application/json" -d '{
  "base64": "SGVsbG8gd29ybGQ=",
  "filename": "file.txt",
  "properties": {
    "webhooks": {
      "status": "https://yoursite.com/webhook/{STATUS}/my-custom-id"
    }
  }
}' 'https://api.copyleaks.com/v3/scans/submit/file/my-custom-id'

Notes:

  • Make sure that the filename will have the extension ".txt".
  • Make sure that the text encoding will be UTF-8