Created
October 20, 2017 08:39
-
-
Save spark2010/46203391a5e2b465c0b95da6ea6efaef to your computer and use it in GitHub Desktop.
Demonstration of calling an API hosted in Knowru using Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'net/http' | |
uri = URI('https://www.knowru.com/api/runnable/your-is-prime-api-name/run/') | |
http = Net::HTTP.new(uri.host, uri.port) | |
req = Net::HTTP::Post.new(uri, 'Authorization' => 'Token your-token', 'Content-Type' => 'application/json', 'Accept' => 'application/json') | |
req.body = {input: {number: 3}}.to_json | |
res = http.request(req) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment