Skip to content

Instantly share code, notes, and snippets.

@arjunkomath
Last active August 31, 2018 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arjunkomath/8c058b02ccc70f5482f2a5862c2ea595 to your computer and use it in GitHub Desktop.
Save arjunkomath/8c058b02ccc70f5482f2a5862c2ea595 to your computer and use it in GitHub Desktop.
Capture JS
// Include https://github.com/blueimp/JavaScript-MD5
var API_URL = 'https://api.capture.techulus.in/';
var your_api_key = 'API_KEY_FROM_CONSOLE';
var your_api_secret = 'API_SECRET_FROM_CONSOLE'
// Target URL
var input_url = encodeURIComponent('http://techulus.in/');
var hash = md5(your_api_secret + 'url=' + input_url);
// Image URL
var result_img_url = API_URL + your_api_key + '/' + hash + '/image?url=' + input_url;
// PDF URL
var result_pdf_url = API_URL + your_api_key + '/' + hash + '/pdf?url=' + input_url;
console.log(result_img_url, result_pdf_url);
@bennybauer
Copy link

The documentation and the url builder suggest using the https://cdn.capture.techulus.in/ endpoint, while the code sample uses the https://api.capture.techulus.in/ endpoint.

What's the difference between using cdn vs api endpoints?

@arjunkomath
Copy link
Author

Both are identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment