check

Copyleaks API Java SDK

Copyleaks SDK is a simple framework that allows you to perform plagiarism scans and track content distribution around the web, using the Copyleaks cloud.

With the Copyleaks SDK you can submit a scan for:

Instructions for using the SDK are below. For a quick example demonstrating the SDK capabilities just look at the code examples under “examples”. You can also watch the following video demonstrating how to easily integrate with the API - https://www.youtube.com/watch?v=KZhw17se0jw.

</ol>

Integration

You can integrate with the Copyleaks SDK in one of two ways:

Now you can use the Copyleaks API in your project. If you are working with our latest version, you can also run the libraries using the code found down on this page.

Signing Up and Getting Your API Key

To use Copyleaks API you need to be a registered user. Signing up is quick and free of charge.

Signup to Copyleaks and confirm your account by clicking the link in the confirmation email. Generate your personal API key on your dashboard (Businesses dashboard/Academic dashboard/Websites dashboard) under 'Access Keys'.

For more information check out our API guide.

Example

This code will show you where the textual content in the parameter ‘url’ has been used online:

public static void Scan(String email, String key, String url) {
	CopyleaksCloud copyleaks = new CopyleaksCloud();
	try {
		System.out.print("Login to Copyleaks cloud...");
		copyleaks.Login(email, key);
		System.out.println("Done!");
		System.out.print("Checking account balance...");
		int creditsBalance = copyleaks.getCredits();
		System.out.println("Done (" + creditsBalance + " credits)!");
		if (creditsBalance == 0) {
			System.out.println(
					"ERROR: You do not have enough credits left in your account to proceed with this scan! 							(current credit balance = "+ creditsBalance + ")");
			return;
		}
		ProcessOptions scanOptions = new ProcessOptions();
		// scanOptions.setSandboxMode(true); // <------ Read more @
		// https://api.copyleaks.com/Documentation/RequestHeaders#sandbox-mode
		// Use the callbacks in order to get notified once the scan results are ready
		// Read more about the callbacks here - https://api.copyleaks.com/GeneralDocumentation/RequestHeaders#http-callbacks
		//scanOptions.setHttpCallback(new URI("http://yourendpoint.com?pid={PID}"));
		//scanOptions.setInProgressResultsHttpCallback(new URI("http://yourendpoint.com?pid={PID}"));
		ResultRecord[] results;
		CopyleaksProcess createdProcess;
		createdProcess = copyleaks.CreateByUrl(new URI(url), scanOptions);
		// Waiting for process completion...
		System.out.println("Scanning...");
		int percents = 0;
		while (percents != 100 && (percents = createdProcess.getCurrentProgress()) <= 100) {
			System.out.println(percents + "%");
			if (percents != 100)
				Thread.sleep(4000);
		}
		results = createdProcess.GetResults();
		if (results.length == 0) {
			System.out.println("No results.");
		} else {
			for (int i = 0; i < results.length; ++i) {
				System.out.println();
				System.out.println(String.format("Result %1$s:", i + 1));
				if (results[i].getURL() != null)
				{
					System.out.println(String.format("Url: %1$s", results[i].getURL()));
				}
				System.out.println(String.format("Information: %1$s copied words (%2$s%%)",
				results[i].getNumberOfCopiedWords(), results[i].getPercents()));
				System.out.println(String.format("Comparison Report: %1$s", results[i].getComparisonReport()));
				System.out.println(String.format("Title: %1$s", results[i].getTitle()));
				System.out.println(String.format("Introduction: %1$s", results[i].getIntroduction()));
				System.out.println(String.format("Embeded Comparison: %1$s",results[i].getEmbededComparison()));
			}
		}
	} catch (CommandFailedException copyleaksException) {
		System.out.println("Failed!");
		System.out.format("*** Error (%d):\n", copyleaksException.getCopyleaksErrorCode());
		System.out.println(copyleaksException.getMessage());
	} catch (Exception ex) {
		System.out.println("Failed!");
		System.out.println("Unhandled Exception");
		System.out.println(ex);
	}
}

Dependencies:

Referenced Assemblies:

Read More