![]() |
Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package mayo.edu.cts2.client.rest.scala import java.net.{HttpURLConnection, URL} import io.Source /** * Created with IntelliJ IDEA. * Author: Scott Bauer bauer.scott@mayo.edu * Date: 10/2/12 * Time: 3:17 PM */ object CTS2RestClient extends App{ val connection = new URL("http://informatics.mayo.edu/cts2/rest/valuesets").openConnection().asInstanceOf[HttpURLConnection] val inputStream = connection.getInputStream val src = Source.fromInputStream(inputStream) src.getLines().foreach(println) } |
Python
Python must be installed on your system. Download the third party library python-rest-client. Add python-rest-client to the PYTHONPATH environment variable to your system.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
__author__ = 'sbauer' from restful_lib import Connection conn = Connection("http://informatics.mayo.edu/cts2/rest") reply = conn.request_get("/valuesets") if reply['headers']['status'] == '200': print reply['body'] conn = Connection("http://informatics.mayo.edu/cts2/rest") reply = conn.request_get("/valuesets?format=json",headers={'Accept':'application/json;q=1.0'}) if reply['headers']['status'] == '200': print reply['body'] print eval(reply['body']) conn = Connection("http://informatics.mayo.edu/cts2/rest") print conn.request_get("/valuesets?matchvalue='Sequence'")['body'] |
...