![]() |
Page History
...
CTS2 Client Quick Start
CTS2 Client Options
REST calls are not platform specific. They can be integrated into a wide variety of platforms.
- Java
- Scala
- Python
- Unix Command line
- Any platform able to handle REST calls and XML or JSON formatted responses
...
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
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'] |
The Current State of CTS2
...