Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Quick Start Guide

Keiichiro Ono edited this page Jun 18, 2015 · 5 revisions

Basic Examples

The design principle of cyREST is simple: make programmer-friendly, easy-to-use REST API for Cytoscape users. These days, almost all popular web services including Google, Twitter, and Facebook have REST API. They are following basic RESTful API design principles and once you learn one of them, it is relatively easy to learn others because they simply map their operations on data objects to basic HTTP operations, which are Create (POST), Read (GET), Update (PUT), and Delete (DELETE).

cyREST follows this design principle. Operations on Cytoscape data objects and functions are mapped to CRUD.

API Examples

Get data from Cytoscape (GET)

  • Get all networks as a list of SUIDs

GET http://localhost:1234/v1/networks


* Get Visual Style names

GET http://localhost:1234/v1/styles


* Get Visual Style named _Directed_ as JSON

GET http://localhost:1234/v1/styles/Directed


* GET list of layout algorithms

GET http://localhost:1234/v1/apply/layouts


* Apply _force-directed_ layout to network with SUID 53

GET http://localhost:1234/v1/apply/layouts/force-directed/53


### Create new objects in Cytoscape

* Send network and tables as JSON
  * Network to be sent:
  ```JSON
{
    "data": {
          "name": "my network 1"
    },
    "elements": {
          "nodes":[...],
          "edges":[...]
    }
}
POST http://localhost:1234/v1/networks

Update existing data

  • Add new nodes to existing network with SUID 52

PUT http://localhost:1234/v1/networks/52


#### Delete existing objects
* Delete all networks in current session

DELETE http://localhost:1234/v1/networks


* Delete a network with SUID 52

DELETE http://localhost:1234/v1/networks/52


* Delete a node with SUID 1200

DELETE http://localhost:1234/v1/networks/52/nodes/1200