Tuesday, February 18, 2014

CURL

Learning CURL today. Will be using it to push updates to a subscriber for our NZ database. first to find then install curl

Step One: Install Visual C++ 2008 Redistributables
For 64bit systems
Visual C++ 2008 Redistributables (x64)
For 32bit systems
Visual C++ 2008 Redistributables (x32)

Step Two: Install Win(32/64) OpenSSL v1.0.0k Light
For 64bit systems
Win64 OpenSSL v1.0.0k Light
For 32bit systems
Win32 OpenSSL v1.0.0k Light

Step Three: Install cURL

Depending on if your system is 32 or 64 bit, download the corresponding curl.exe.
For example, go to the Win32 - Generic section and download the Win32 binary with SSL support (the one where SSL is not crossed out).
Unzip the file and copy curl.exe to C:\Windows\System32
Step Four: Install Recent CA Certificates

Do not skip this step.
Download a recent copy of valid CERT files from http://curl.haxx.se/docs/caextract.html.
Copy it to the same folder as you placed curl.exe (C:\Windows\System32) and rename it curl-ca-bundle.crt.
Test cURL

Be sure you are an Admin in Canvas.
Open a DOS command window, type in the following and press enter
curl https://yourcanvas.test.instructure.com (replace [yourcanvas] with your Canvas domain name)
You should get raw HTML output on the screen.
If you get an error such as ‘Command not found’ then cURL has not been installed

Notes on Running Commands
The DOS environment doesn't seem to like single quotes. Any example that uses single quotes to surround values is invalid on windows. The single quotes must be replaced with double quotes.
curl.exe -X POST -H "Content-Type: application/zip" --data-binary @BATCH_CANVAS_ACCOUNTS-TC.zip -H "Authorization: Bearer 7Ec3AJXBsRIgvFjkcF8P3rCtzDilNm8LuHcF5fki2" "https://<yourdomain>.instructure.com/api/v1/accounts/<your_account>/sis_imports.json?import_type=instructure_csv"

This was a really cool site for how to install with the different options of installing: http://www.confusedbycode.com/curl/

Now for the pusher test. Too cool
Go to pusher.com
Click Try it now
Paste the code provided in your command prompt

cool huh?

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.